diff --git a/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts b/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts index 86de39ca..93de7ac8 100644 --- a/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceContext.ts @@ -29,10 +29,18 @@ type WorkspaceContextValue = { const noop = () => {}; -const WorkspaceContext = createContext({ - workspace: null, - cwd: '~', - panelConfigs: {}, +/** + * The interaction half of the context, switched off — every field a panel uses to rearrange the + * workspace, plus the state those interactions run on. `WorkspaceLayout` renders a tree nobody can + * rearrange (job detail panes, settings, dashboard previews), and it used to say so by repeating + * eleven fields at the call site, which is a list you can silently fall behind: add a field to the + * context and only one of the two providers gets it. + * + * `root` and `cwd` are deliberately not in here. They are facts about where the workspace *is*, not + * interactions, and the inert renderer has no answer for them — its consumers only read `root` when + * `cwd` is scoped, which it never is there. + */ +export const inertInteraction = { setPanelConfig: noop, swapSourceId: null, setSwapSourceId: noop, @@ -44,6 +52,13 @@ const WorkspaceContext = createContext({ maximizedPanelId: null, setMaximizedPanelId: noop, transitioningPanelId: null, +} satisfies Partial; + +const WorkspaceContext = createContext({ + workspace: null, + cwd: '~', + panelConfigs: {}, + ...inertInteraction, isMobile: false, onMobileBack: null, }); diff --git a/src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx b/src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx index 4ed3980d..58e6c5d8 100644 --- a/src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx +++ b/src/workspaces/officerdev/src/components/Workspace/WorkspaceLayout.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import type { LayoutNode, AppRegistryMap, PanelComponents } from './types'; import { updateSizes, collectPanelConfigs } from './layout-utils'; -import { WorkspaceProvider } from './WorkspaceContext'; +import { WorkspaceProvider, inertInteraction } from './WorkspaceContext'; import { WorkspaceRenderer } from './WorkspaceRenderer'; import { useAppRegistry } from '../../AppRegistry/useAppRegistry'; @@ -36,7 +36,7 @@ export const WorkspaceLayout = ({ layout, onLayoutChange, registry: registryProp // dashboard previews. It is not a dashboard and not a screen, and a panel that asks should be told so // rather than handed something that parses. return ( - +