diff --git a/frontend/src/core/components/AppProviders.tsx b/frontend/src/core/components/AppProviders.tsx
index 3bf96f29f3..24f7931884 100644
--- a/frontend/src/core/components/AppProviders.tsx
+++ b/frontend/src/core/components/AppProviders.tsx
@@ -15,6 +15,7 @@ import { SignatureProvider } from "@app/contexts/SignatureContext";
import { OnboardingProvider } from "@app/contexts/OnboardingContext";
import { TourOrchestrationProvider } from "@app/contexts/TourOrchestrationContext";
import { AdminTourOrchestrationProvider } from "@app/contexts/AdminTourOrchestrationContext";
+import { PageEditorProvider } from "@app/contexts/PageEditorContext";
import ErrorBoundary from "@app/components/shared/ErrorBoundary";
import { useScarfTracking } from "@app/hooks/useScarfTracking";
import { useAppInitialization } from "@app/hooks/useAppInitialization";
@@ -64,15 +65,17 @@ export function AppProviders({ children, appConfigRetryOptions, appConfigProvide
-
-
-
-
- {children}
-
-
-
-
+
+
+
+
+
+ {children}
+
+
+
+
+
diff --git a/frontend/src/core/components/layout/Workbench.tsx b/frontend/src/core/components/layout/Workbench.tsx
index 04f6acf70a..e6ee6d47f7 100644
--- a/frontend/src/core/components/layout/Workbench.tsx
+++ b/frontend/src/core/components/layout/Workbench.tsx
@@ -1,14 +1,11 @@
-import { useMemo } from 'react';
-import React from 'react';
import { Box } from '@mantine/core';
import { useRainbowThemeContext } from '@app/components/shared/RainbowThemeProvider';
import { useToolWorkflow } from '@app/contexts/ToolWorkflowContext';
import { useFileHandler } from '@app/hooks/useFileHandler';
import { useFileState } from '@app/contexts/FileContext';
import { useNavigationState, useNavigationActions } from '@app/contexts/NavigationContext';
-import { useViewer } from '@app/contexts/ViewerContext';
-import { PageEditorProvider } from '@app/contexts/PageEditorContext';
import { isBaseWorkbench } from '@app/types/workbench';
+import { useViewer } from '@app/contexts/ViewerContext';
import { useAppConfig } from '@app/contexts/AppConfigContext';
import styles from '@app/components/layout/Workbench.module.css';
@@ -27,13 +24,11 @@ export default function Workbench() {
const { config } = useAppConfig();
// Use context-based hooks to eliminate all prop drilling
- const { state, selectors } = useFileState();
+ const { selectors } = useFileState();
const { workbench: currentView } = useNavigationState();
const { actions: navActions } = useNavigationActions();
const setCurrentView = navActions.setWorkbench;
-
- // Create stable reference for activeFiles based on file IDs
- const activeFiles = useMemo(() => selectors.getFiles(), [state.files.ids]);
+ const activeFiles = selectors.getFiles();
const {
previewFile,
pageEditorFunctions,
@@ -77,28 +72,31 @@ export default function Workbench() {
const renderMainContent = () => {
if (activeFiles.length === 0) {
- return ;
+ return (
+
+ );
}
switch (currentView) {
- case 'fileEditor':
+ case "fileEditor":
return (
{
- setCurrentView('pageEditor');
+ setCurrentView("pageEditor");
},
onMergeFiles: (filesToMerge) => {
addFiles(filesToMerge);
- setCurrentView('viewer');
- },
+ setCurrentView("viewer");
+ }
})}
/>
);
- case 'viewer':
+ case "viewer":
return (
);
- case 'pageEditor':
+ case "pageEditor":
return (
<>
-
+
{pageEditorFunctions && (
view.workbenchId === currentView && view.data != null,
- );
+ const customView = customWorkbenchViews.find((view) => view.workbenchId === currentView && view.data != null);
if (customView) {
const CustomComponent = customView.component;
return ;
@@ -154,54 +152,52 @@ export default function Workbench() {
};
return (
-
+
+ {/* Top Controls */}
+ {activeFiles.length > 0 && (
+ {
+ const stub = selectors.getStirlingFileStub(f.fileId);
+ return { fileId: f.fileId, name: f.name, versionNumber: stub?.versionNumber };
+ })}
+ currentFileIndex={activeFileIndex}
+ onFileSelect={setActiveFileIndex}
+ />
+ )}
+
+ {/* Dismiss All Errors Button */}
+
+
+ {/* Main content area */}
- {/* Top Controls */}
- {activeFiles.length > 0 && (
- {
- const stub = selectors.getStirlingFileStub(f.fileId);
- return { fileId: f.fileId, name: f.name, versionNumber: stub?.versionNumber };
- })}
- currentFileIndex={activeFileIndex}
- onFileSelect={setActiveFileIndex}
- />
- )}
-
- {/* Dismiss All Errors Button */}
-
-
- {/* Main content area */}
-
- {renderMainContent()}
-
-
-
+ {renderMainContent()}
-
+
+
+
);
}