Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-fix navigating to a space with selected trove #1925

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) => {
Haroldthe24th marked this conversation as resolved.
Show resolved Hide resolved
if (item.type === 'folder') {
return createTree(item.path, item);
} else {
Expand Down