Skip to content

Commit

Permalink
Providing a better experience of the context switching between public…
Browse files Browse the repository at this point in the history
… and private feeds when a user sign's in and out
  • Loading branch information
PintoGideon committed Feb 15, 2024
1 parent b5154d1 commit 1662f76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/components/Feeds/FeedListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ const TableSelectable: React.FunctionComponent = () => {
}, [dispatch]);

React.useEffect(() => {
if (!type) {
const feedType = isLoggedIn ? "private" : "public";
if (!type || (!isLoggedIn && type === "private")) {
navigate(
`/feeds?search=${search}&searchType=${searchType}&page=${page}&perPage=${perPage}&type=${feedType}`,
`/feeds?search=${search}&searchType=${searchType}&page=${page}&perPage=${perPage}&type=public`,
);
}
}, [isLoggedIn, navigate, perPage, page, searchType, search, type]);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Feeds/FeedView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export default function FeedView() {
});

React.useEffect(() => {
if (!type) {
if (!type || (type === "private" && !isLoggedIn)) {
navigate("/feeds?type=public");
}
}, [type, navigate]);
}, [type, navigate, isLoggedIn]);

React.useEffect(() => {
const feed: Feed | undefined = privateFeed || publicFeed;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Wrapper/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const AnonSidebarImpl: React.FC<AllProps> = ({
itemId="analyses"
isActive={sidebarActiveItem === "analyses"}
>
<Link to="/feeds">New and Existing Analyses</Link>
<Link to="/feeds?type=public">New and Existing Analyses</Link>
</NavItem>
<NavItem itemId="catalog" isActive={sidebarActiveItem === "catalog"}>
<Link to="/catalog">Plugins</Link>
Expand Down

0 comments on commit 1662f76

Please sign in to comment.