From 717580f6e443fdce73d737aa33c1b471c7ee287a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Fri, 7 Aug 2026 09:33:33 +0000 Subject: [PATCH] stop the framework carrying file-browser vocabulary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `initialFilePath` and `defaultFileSort` were declared on the workspace context, plumbed through `WorkspaceView`'s props and read by exactly one panel wrapper — and set by zero callers. The sort shape in particular (`{field: 'name'|'size'|'type'|'date', direction}`) is file-browser vocabulary sitting in the framework's type file and re-exported from two barrels, so every app that imports the context could see it. Nothing changes at runtime: both were always undefined, which is what the wrapper now passes by omitting them. --- .../FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx | 5 ++--- .../src/components/Workspace/WorkspaceContext.ts | 7 ------- .../officerdev/src/components/Workspace/WorkspaceView.tsx | 7 +------ .../officerdev/src/components/Workspace/index.ts | 1 - src/workspaces/officerdev/src/index.ts | 1 - 5 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx index 2f7c7b7d..bc95236c 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserPanelWrapper.tsx @@ -4,8 +4,7 @@ import { FileBrowserApp } from './FileBrowserApp'; const cwdToPath = (cwd: string) => (cwd === '~' ? '/' : cwd.slice(1)); export const FileBrowserPanelWrapper = () => { - const { cwd, initialFilePath, defaultFileSort } = useWorkspace(); + const { cwd } = useWorkspace(); const basePath = cwdToPath(cwd); - const initialPath = basePath === '/' ? initialFilePath : undefined; - return ; + return ; }; diff --git a/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts b/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts index e6920ba7..77897c3a 100644 --- a/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts @@ -4,18 +4,11 @@ import type { DropPosition } from './layout-utils'; import type { PanelConfig } from './types'; import type { WorkspaceIdentity } from './workspace-identity'; -export type DefaultFileSort = { - field: 'name' | 'size' | 'type' | 'date'; - direction: 'asc' | 'desc'; -}; - type WorkspaceContextValue = { /** Which dashboard or screen this panel is on. Null in a preview or a settings pane. */ workspace: WorkspaceIdentity | null; cwd: string; root?: string; - initialFilePath?: string; - defaultFileSort?: DefaultFileSort; promptPrefix?: string; // Per-panel app settings, by panel id. A map rather than a getter so a config change re-renders the // panel that owns it — apps read this through `usePanelConfig`, not directly. diff --git a/src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx b/src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx index daba244f..9d139158 100644 --- a/src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceView.tsx @@ -4,7 +4,6 @@ import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '@/componen import { useIsMobile } from 'hooks/useIsMobile'; import { useSessionState } from 'hooks/useSessionState'; import type { LayoutNode, DashboardState, EphemeralPanels, PanelComponents, PanelConfig } from './types'; -import type { DefaultFileSort } from './WorkspaceContext'; import type { DropPosition } from './layout-utils'; import { splitPanel, removePanel, setApp, updateSizes, swapPanels, movePanel, countPanels, setZoom, setPanelConfig, collectPanelConfigs } from './layout-utils'; import { WorkspaceProvider } from './WorkspaceContext'; @@ -17,8 +16,6 @@ type WorkspaceViewProps = { locked?: boolean; cwd?: string; root?: string; - initialFilePath?: string; - defaultFileSort?: DefaultFileSort; promptPrefix?: string; components?: PanelComponents; ephemeral?: EphemeralPanels | null; @@ -28,7 +25,7 @@ type WorkspaceViewProps = { const noop = () => {}; -export const WorkspaceView = ({ workspace, locked, cwd = '~', root, initialFilePath, defaultFileSort, promptPrefix, components, ephemeral, mobilePanelId, onMobilePanelChange }: WorkspaceViewProps) => { +export const WorkspaceView = ({ workspace, locked, cwd = '~', root, promptPrefix, components, ephemeral, mobilePanelId, onMobilePanelChange }: WorkspaceViewProps) => { const { registry } = useAppRegistry(); const isMobile = useIsMobile(); @@ -193,8 +190,6 @@ export const WorkspaceView = ({ workspace, locked, cwd = '~', root, initialFileP workspace: identity, cwd, root, - initialFilePath, - defaultFileSort, promptPrefix, panelConfigs, setPanelConfig: locked ? noop : handleSetPanelConfig, diff --git a/src/workspaces/officerdev/src/components/Workspace/index.ts b/src/workspaces/officerdev/src/components/Workspace/index.ts index 466889cf..4acb5483 100644 --- a/src/workspaces/officerdev/src/components/Workspace/index.ts +++ b/src/workspaces/officerdev/src/components/Workspace/index.ts @@ -27,7 +27,6 @@ export { setPanelConfig, collectPanelConfigs, } from './layout-utils'; -export type { DefaultFileSort } from './WorkspaceContext'; export type { WorkspaceIdentity } from './workspace-identity'; export { parseWorkspaceKey } from './workspace-identity'; export { WorkspaceProvider, useWorkspace } from './WorkspaceContext'; diff --git a/src/workspaces/officerdev/src/index.ts b/src/workspaces/officerdev/src/index.ts index 66e25d6e..3748c0f8 100644 --- a/src/workspaces/officerdev/src/index.ts +++ b/src/workspaces/officerdev/src/index.ts @@ -141,5 +141,4 @@ export type { EphemeralPanels, DropPosition, HomeRoot, - DefaultFileSort, } from './components/Workspace';