Skip to content

Commit

Permalink
Site Editor: Move 'ErrorBoundary' up to the React tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Aug 5, 2024
1 parent 8b1b939 commit cdbff5b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 35 deletions.
17 changes: 10 additions & 7 deletions packages/edit-site/src/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
* Internal dependencies
*/
import ErrorBoundary from '../error-boundary';
import Layout from '../layout';
import { unlock } from '../../lock-unlock';
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
Expand Down Expand Up @@ -54,13 +55,15 @@ export default function App() {

return (
<SlotFillProvider>
<GlobalStylesProvider>
<UnsavedChangesWarning />
<RouterProvider>
<AppLayout />
<PluginArea onError={ onPluginAreaError } />
</RouterProvider>
</GlobalStylesProvider>
<ErrorBoundary>
<GlobalStylesProvider>
<UnsavedChangesWarning />
<RouterProvider>
<AppLayout />
<PluginArea onError={ onPluginAreaError } />
</RouterProvider>
</GlobalStylesProvider>
</ErrorBoundary>
</SlotFillProvider>
);
}
51 changes: 23 additions & 28 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
/**
* Internal dependencies
*/
import ErrorBoundary from '../error-boundary';
import { store as editSiteStore } from '../../store';
import { default as SiteHub, SiteHubMobile } from '../site-hub';
import ResizableFrame from '../resizable-frame';
Expand Down Expand Up @@ -226,33 +225,29 @@ export default function Layout( { route } ) {
) }
ref={ animationRef }
>
<ErrorBoundary>
<ResizableFrame
isReady={ ! isEditorLoading }
isFullWidth={
canvasMode === 'edit'
}
defaultSize={ {
width:
canvasSize.width -
24 /* $canvas-padding */,
height: canvasSize.height,
} }
isOversized={
isResizableFrameOversized
}
setIsOversized={
setIsResizableFrameOversized
}
innerContentStyle={ {
background:
gradientValue ??
backgroundColor,
} }
>
{ areas.preview }
</ResizableFrame>
</ErrorBoundary>
<ResizableFrame
isReady={ ! isEditorLoading }
isFullWidth={ canvasMode === 'edit' }
defaultSize={ {
width:
canvasSize.width -
24 /* $canvas-padding */,
height: canvasSize.height,
} }
isOversized={
isResizableFrameOversized
}
setIsOversized={
setIsResizableFrameOversized
}
innerContentStyle={ {
background:
gradientValue ??
backgroundColor,
} }
>
{ areas.preview }
</ResizableFrame>
</div>
) }
</div>
Expand Down

0 comments on commit cdbff5b

Please sign in to comment.