stop the framework carrying file-browser vocabulary

`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.
This commit is contained in:
2026-08-07 09:33:33 +00:00
parent dbe585fd72
commit 717580f6e4
5 changed files with 3 additions and 18 deletions
@@ -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 <FileBrowserApp basePath={basePath} rootOverride={basePath !== '/' ? 'home' : undefined} initialPath={initialPath} defaultSort={defaultFileSort} />;
return <FileBrowserApp basePath={basePath} rootOverride={basePath !== '/' ? 'home' : undefined} />;
};
@@ -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.
@@ -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,
@@ -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';
-1
View File
@@ -141,5 +141,4 @@ export type {
EphemeralPanels,
DropPosition,
HomeRoot,
DefaultFileSort,
} from './components/Workspace';