Skip to content

Commit

Permalink
-fix navigating to a space with selected trove
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroldthe24th committed Jul 17, 2023
1 parent 4d47f0c commit 8e57b4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions trove/src/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ export const Navigation = ({ selectedSpace }: Props) => {
//presisted space data for filtering search correctly
const navigate = useNavigate();
const setSpace = useTroveStore((store: TroveStore) => store.setSpace);
const setSelectedTopLevelFolder = useTroveStore(
(store: TroveStore) => store.setSelectedTopLevelFolder
);
useEffect(() => {
//everytime space changes redirect to that space
if (selectedSpace) {
//make sure we don't have a selected top level forlder when we navigate (trove)
setSelectedTopLevelFolder(null);
navigate(selectedSpace);
}
}, [selectedSpace]);
Expand Down
2 changes: 1 addition & 1 deletion trove/src/components/RecursiveTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const RecursiveTree = memo(
};
return (
<Box>
{itemList.map((item: any) => {
{itemList?.map((item: any) => {
if (item.type === 'folder') {
return createTree(item.path, item);
} else {
Expand Down

0 comments on commit 8e57b4c

Please sign in to comment.