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 fe429ba4..3c3ba6df 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/browser.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/browser.tsx @@ -76,6 +76,11 @@ export default memo( DriveCurrentFolderAtom({ context: context, initialFolderId: dirId || viewId || initialParentId || 'user_'+user?.id }), ); + // set the initial view to the user's home directory + useEffect(() => { + !dirId && !viewId && history.push(RouterServices.generateRouteFromState({viewId: parentId})); + }, [viewId, dirId]); + const [loadingParentChange, setLoadingParentChange] = useState(false); const { sharedWithMe, diff --git a/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx b/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx index 0d8f1e9e..8682fd4c 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx @@ -36,7 +36,7 @@ export const DocumentRow = ({ }: DriveItemProps) => { const history = useHistory(); const [hover, setHover] = useState(false); - const { open } = useDrivePreview(); + const { open,close } = useDrivePreview(); const company = useRouterCompany(); const { itemId } = useRouteState(); @@ -48,6 +48,11 @@ export const DocumentRow = ({ const hasThumbnails = !!metadata.thumbnails?.length || false; useEffect(() => { + // close the preview if the item is not set or the user navigated away + if(!itemId) { + close(); + } + // open the preview if the item is set if(itemId == item.id) { open(item); } @@ -58,7 +63,6 @@ export const DocumentRow = ({ console.log("DEVICE:: " + device); if (device != "ios" && device != "android") { history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id, dirId: ''})); - //open(item); } };