diff --git a/tdrive/frontend/src/app/views/client/body/drive/browser.tsx b/tdrive/frontend/src/app/views/client/body/drive/browser.tsx index 67b56b6b..15df573d 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/browser.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/browser.tsx @@ -61,9 +61,9 @@ export default memo( const companyId = useRouterCompany(); setTdriveTabToken(tdriveTabContextToken || null); const [filter, setFilter] = useRecoilState(SharedWithMeFilterState); - + const { viewId } = useRouteState(); const [parentId, _setParentId] = useRecoilState( - DriveCurrentFolderAtom({ context: context, initialFolderId: initialParentId || 'user_'+user?.id }), + DriveCurrentFolderAtom({ context: context, initialFolderId: viewId || initialParentId || 'user_'+user?.id }), ); const [loadingParentChange, setLoadingParentChange] = useState(false); @@ -136,7 +136,6 @@ export default memo( .sort((a, b) => a.name.localeCompare(b.name)); const onBuildContextMenu = useOnBuildContextMenu(children, initialParentId); - const { viewId } = useRouteState(); const handleDragOver = (event: { preventDefault: () => void; }) => { event.preventDefault(); diff --git a/tdrive/frontend/src/app/views/client/side-bar/index.tsx b/tdrive/frontend/src/app/views/client/side-bar/index.tsx index 43ce67af..805ef988 100644 --- a/tdrive/frontend/src/app/views/client/side-bar/index.tsx +++ b/tdrive/frontend/src/app/views/client/side-bar/index.tsx @@ -31,8 +31,9 @@ export default () => { const location = useLocation(); const company = useRouterCompany(); const workspace = useRouterWorkspace(); + const { viewId, itemId } = RouterServices.getStateFromRoute(); const [parentId, setParentId] = useRecoilState( - DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }), + DriveCurrentFolderAtom({ initialFolderId: viewId || 'user_'+user?.id }), ); const active = false; const { access: rootAccess } = useDriveItem('user_'+user?.id); @@ -42,7 +43,6 @@ export default () => { if ((path || [])[0]?.id === 'user_' + user?.id) folderType = 'personal'; if (inTrash) folderType = 'trash'; if (sharedWithMe) folderType = 'shared'; - const { viewId, itemId } = RouterServices.getStateFromRoute(); useEffect(() => { !itemId && viewId && setParentId(viewId); }, [viewId, itemId]);