From 585f234b5b32a69bd482d123cf7a8ee6005cda81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Fri, 7 Aug 2026 09:35:03 +0000 Subject: [PATCH] take out the props the previous commit orphaned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `initialPath` and `defaultSort` reached `FileBrowserApp` from nowhere else — the panel wrapper was their only caller, and it was passing the two context fields that had no setter. Both remaining callers pass neither, so the whole chain below them was already running on its defaults. That includes `isolated`, which was `!!initialPath` and therefore always false: the unscoped browser has been mirroring its folder into `files/currentPath` unconditionally, which is what the comment beside it describes. Same behaviour, one fewer flag that reads as if it sometimes fires. --- .../FileBrowserApp/FileBrowserApp.tsx | 11 ++--------- .../FileBrowserApp/components/FileGrid.tsx | 5 ++--- .../FileBrowserApp/useFileBrowserApp.ts | 18 +++--------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx index 3945ee43..e5de9918 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx @@ -8,20 +8,13 @@ import { VideoDownloadDialog } from './components/VideoDownloadDialog'; import { DictateDialog } from './components/DictateDialog'; import { useFileBrowserApp } from './useFileBrowserApp'; -type DefaultSort = { - field: 'name' | 'size' | 'type' | 'date'; - direction: 'asc' | 'desc'; -}; - type FileBrowserAppProps = { basePath?: string; rootOverride?: string; - initialPath?: string; - defaultSort?: DefaultSort; }; -export const FileBrowserApp = ({ basePath = '/', rootOverride, initialPath, defaultSort }: FileBrowserAppProps) => { - const fileBrowserManager = useFileBrowserApp(basePath, rootOverride, initialPath, defaultSort); +export const FileBrowserApp = ({ basePath = '/', rootOverride }: FileBrowserAppProps) => { + const fileBrowserManager = useFileBrowserApp(basePath, rootOverride); const { handleNavigate } = fileBrowserManager; return ( diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx index 54acb2fe..892c7f3f 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx @@ -76,10 +76,9 @@ export const FileGrid = ({ fileBrowserManager }: FileGridProps) => { setSearchQuery, searchInputRef, } = fileBrowserManager; - const { defaultSort } = fileBrowserManager; const lastClickedIdx = useRef(-1); - const [sortField, setSortField] = useState(defaultSort?.field ?? 'name'); - const [sortDirection, setSortDirection] = useState(defaultSort?.direction ?? 'asc'); + const [sortField, setSortField] = useState('name'); + const [sortDirection, setSortDirection] = useState('asc'); const sorted = (() => { const compare = (a: DirEntry, b: DirEntry): number => { diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts index e9cdca34..a9fcc0f2 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts @@ -8,31 +8,20 @@ import { useUserState } from 'state/useUserState'; import { useAuth } from 'hooks/useAuth'; import { usePanelChannel } from 'hooks/usePanelChannel'; -type DefaultSort = { - field: 'name' | 'size' | 'type' | 'date'; - direction: 'asc' | 'desc'; -}; - -export const useFileBrowserApp = ( - basePath: string, - rootOverride?: string, - initialPath?: string, - defaultSort?: DefaultSort, -) => { +export const useFileBrowserApp = (basePath: string, rootOverride?: string) => { const { user } = useAuth(); const navigate = useNavigate(); const [searchParams, setSearchParams] = useSearchParams(); const homeRoot = 'home'; const [, setGlobalPath] = useUserState('files/currentPath', '/'); - const [currentPath, setLocalPath] = useState(initialPath ?? basePath); + const [currentPath, setLocalPath] = useState(basePath); const scoped = basePath !== '/'; - const isolated = !!initialPath; // Navigation is session-local — the browser always opens at home, never restoring the // last path. The main (unscoped) browser still mirrors its folder into files/currentPath // so the Create Dashboard flow can default a new dashboard's cwd to it. const setCurrentPath = (path: string) => { setLocalPath(path); - if (!scoped && !isolated) setGlobalPath(path); + if (!scoped) setGlobalPath(path); }; const [entries, setEntries] = useState([]); const [rootDir, setRootDir] = useState(''); @@ -639,7 +628,6 @@ export const useFileBrowserApp = ( // View viewMode, setViewMode, - defaultSort, showHidden, setShowHidden, hiddenForced,