Skip to content

Commit

Permalink
Wrap full app
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed May 24, 2024
1 parent 1c17120 commit b969fd3
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 61 deletions.
38 changes: 18 additions & 20 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
store as editorStore,
privateApis as editorPrivateApis,
} from '@wordpress/editor';
import { StrictMode, useMemo } from '@wordpress/element';
import { useMemo } from '@wordpress/element';
import { SlotFillProvider } from '@wordpress/components';
import { store as coreStore } from '@wordpress/core-data';
import { CommandMenu } from '@wordpress/commands';
Expand Down Expand Up @@ -95,25 +95,23 @@ function Editor( {
}

return (
<StrictMode>
<SlotFillProvider>
<ExperimentalEditorProvider
settings={ editorSettings }
post={ post }
initialEdits={ initialEdits }
useSubRegistry={ false }
__unstableTemplate={ template }
{ ...props }
>
<ErrorBoundary>
<CommandMenu />
<EditorInitialization />
<Layout initialPost={ initialPost } />
</ErrorBoundary>
<PostLockedModal />
</ExperimentalEditorProvider>
</SlotFillProvider>
</StrictMode>
<SlotFillProvider>
<ExperimentalEditorProvider
settings={ editorSettings }
post={ post }
initialEdits={ initialEdits }
useSubRegistry={ false }
__unstableTemplate={ template }
{ ...props }
>
<ErrorBoundary>
<CommandMenu />
<EditorInitialization />
<Layout initialPost={ initialPost } />
</ErrorBoundary>
<PostLockedModal />
</ExperimentalEditorProvider>
</SlotFillProvider>
);
}

Expand Down
16 changes: 9 additions & 7 deletions packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
__experimentalRegisterExperimentalCoreBlocks,
} from '@wordpress/block-library';
import deprecated from '@wordpress/deprecated';
import { createRoot } from '@wordpress/element';
import { createRoot, StrictMode } from '@wordpress/element';
import { dispatch, select } from '@wordpress/data';
import { store as preferencesStore } from '@wordpress/preferences';
import {
Expand Down Expand Up @@ -131,12 +131,14 @@ export function initializeEditor(
window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );

root.render(
<Editor
settings={ settings }
postId={ postId }
postType={ postType }
initialEdits={ initialEdits }
/>
<StrictMode>
<Editor
settings={ settings }
postId={ postId }
postType={ postType }
initialEdits={ initialEdits }
/>
</StrictMode>
);

return root;
Expand Down
21 changes: 9 additions & 12 deletions packages/edit-site/src/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { store as noticesStore } from '@wordpress/notices';
import { useDispatch } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
import { PluginArea } from '@wordpress/plugins';
import { StrictMode } from '@wordpress/element';
import { privateApis as routerPrivateApis } from '@wordpress/router';

/**
Expand Down Expand Up @@ -38,16 +37,14 @@ export default function App() {
}

return (
<StrictMode>
<SlotFillProvider>
<GlobalStylesProvider>
<UnsavedChangesWarning />
<RouterProvider>
<Layout />
<PluginArea onError={ onPluginAreaError } />
</RouterProvider>
</GlobalStylesProvider>
</SlotFillProvider>
</StrictMode>
<SlotFillProvider>
<GlobalStylesProvider>
<UnsavedChangesWarning />
<RouterProvider>
<Layout />
<PluginArea onError={ onPluginAreaError } />
</RouterProvider>
</GlobalStylesProvider>
</SlotFillProvider>
);
}
8 changes: 6 additions & 2 deletions packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@wordpress/block-library';
import { dispatch } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { createRoot } from '@wordpress/element';
import { createRoot, StrictMode } from '@wordpress/element';
import { store as editorStore } from '@wordpress/editor';
import { store as preferencesStore } from '@wordpress/preferences';
import {
Expand Down Expand Up @@ -85,7 +85,11 @@ export function initializeEditor( id, settings ) {
window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );

root.render( <App /> );
root.render(
<StrictMode>
<App />
</StrictMode>
);

return root;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
store as coreStore,
useResourcePermissions,
} from '@wordpress/core-data';
import { StrictMode, useMemo } from '@wordpress/element';
import { useMemo } from '@wordpress/element';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
import { store as preferencesStore } from '@wordpress/preferences';
Expand Down Expand Up @@ -112,22 +112,20 @@ export default function WidgetAreasBlockEditorProvider( {
);

return (
<StrictMode>
<SlotFillProvider>
<KeyboardShortcuts.Register />
<BlockKeyboardShortcuts />
<ExperimentalBlockEditorProvider
value={ blocks }
onInput={ onInput }
onChange={ onChange }
settings={ settings }
useSubRegistry={ false }
{ ...props }
>
{ children }
<PatternsMenuItems rootClientId={ widgetAreaId } />
</ExperimentalBlockEditorProvider>
</SlotFillProvider>
</StrictMode>
<SlotFillProvider>
<KeyboardShortcuts.Register />
<BlockKeyboardShortcuts />
<ExperimentalBlockEditorProvider
value={ blocks }
onInput={ onInput }
onChange={ onChange }
settings={ settings }
useSubRegistry={ false }
{ ...props }
>
{ children }
<PatternsMenuItems rootClientId={ widgetAreaId } />
</ExperimentalBlockEditorProvider>
</SlotFillProvider>
);
}
8 changes: 6 additions & 2 deletions packages/edit-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { createRoot } from '@wordpress/element';
import { StrictMode, createRoot } from '@wordpress/element';
import {
registerCoreBlocks,
__experimentalGetCoreBlocks,
Expand Down Expand Up @@ -91,7 +91,11 @@ export function initializeEditor( id, settings ) {
// see: https://github.com/WordPress/gutenberg/issues/33097
setFreeformContentHandlerName( 'core/html' );

root.render( <Layout blockEditorSettings={ settings } /> );
root.render(
<StrictMode>
<Layout blockEditorSettings={ settings } />
</StrictMode>
);

return root;
}
Expand Down

0 comments on commit b969fd3

Please sign in to comment.