Skip to content

Commit

Permalink
Enable React StricMode again
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Feb 2, 2023
1 parent 95f3eb9 commit 532b1d9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 48 deletions.
42 changes: 23 additions & 19 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
store as editorStore,
experiments as editorExperiments,
} from '@wordpress/editor';
import { useMemo } from '@wordpress/element';
import { StrictMode, useMemo } from '@wordpress/element';
import { SlotFillProvider } from '@wordpress/components';
import { store as coreStore } from '@wordpress/core-data';
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
Expand Down Expand Up @@ -173,24 +173,28 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
}

return (
<ShortcutProvider>
<SlotFillProvider>
<ExperimentalEditorProvider
settings={ editorSettings }
post={ post }
initialEdits={ initialEdits }
useSubRegistry={ false }
__unstableTemplate={ isTemplateMode ? template : undefined }
{ ...props }
>
<ErrorBoundary>
<EditorInitialization postId={ postId } />
<Layout styles={ styles } />
</ErrorBoundary>
<PostLockedModal />
</ExperimentalEditorProvider>
</SlotFillProvider>
</ShortcutProvider>
<StrictMode>
<ShortcutProvider>
<SlotFillProvider>
<ExperimentalEditorProvider
settings={ editorSettings }
post={ post }
initialEdits={ initialEdits }
useSubRegistry={ false }
__unstableTemplate={
isTemplateMode ? template : undefined
}
{ ...props }
>
<ErrorBoundary>
<EditorInitialization postId={ postId } />
<Layout styles={ styles } />
</ErrorBoundary>
<PostLockedModal />
</ExperimentalEditorProvider>
</SlotFillProvider>
</ShortcutProvider>
</StrictMode>
);
}

Expand Down
24 changes: 13 additions & 11 deletions packages/edit-site/src/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { SlotFillProvider, Popover } from '@wordpress/components';
import { UnsavedChangesWarning } from '@wordpress/editor';
import { StrictMode } from '@wordpress/element';
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
import { store as noticesStore } from '@wordpress/notices';
import { useDispatch } from '@wordpress/data';
Expand Down Expand Up @@ -31,16 +32,17 @@ export default function App() {
}

return (
<ShortcutProvider style={ { height: '100%' } }>
<SlotFillProvider>
<Popover.Slot />
<UnsavedChangesWarning />

<Routes>
<Layout />
<PluginArea onError={ onPluginAreaError } />
</Routes>
</SlotFillProvider>
</ShortcutProvider>
<StrictMode>
<ShortcutProvider style={ { height: '100%' } }>
<SlotFillProvider>
<Popover.Slot />
<UnsavedChangesWarning />
<Routes>
<Layout />
<PluginArea onError={ onPluginAreaError } />
</Routes>
</SlotFillProvider>
</ShortcutProvider>
</StrictMode>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
store as coreStore,
useResourcePermissions,
} from '@wordpress/core-data';
import { useMemo } from '@wordpress/element';
import { StrictMode, useMemo } from '@wordpress/element';
import {
BlockEditorKeyboardShortcuts,
CopyHandler,
Expand Down Expand Up @@ -99,22 +99,26 @@ export default function WidgetAreasBlockEditorProvider( {
);

return (
<ShortcutProvider>
<BlockEditorKeyboardShortcuts.Register />
<KeyboardShortcuts.Register />
<SlotFillProvider>
<ExperimentalBlockEditorProvider
value={ blocks }
onInput={ onInput }
onChange={ onChange }
settings={ settings }
useSubRegistry={ false }
{ ...props }
>
<CopyHandler>{ children }</CopyHandler>
<ReusableBlocksMenuItems rootClientId={ widgetAreaId } />
</ExperimentalBlockEditorProvider>
</SlotFillProvider>
</ShortcutProvider>
<StrictMode>
<ShortcutProvider>
<BlockEditorKeyboardShortcuts.Register />
<KeyboardShortcuts.Register />
<SlotFillProvider>
<ExperimentalBlockEditorProvider
value={ blocks }
onInput={ onInput }
onChange={ onChange }
settings={ settings }
useSubRegistry={ false }
{ ...props }
>
<CopyHandler>{ children }</CopyHandler>
<ReusableBlocksMenuItems
rootClientId={ widgetAreaId }
/>
</ExperimentalBlockEditorProvider>
</SlotFillProvider>
</ShortcutProvider>
</StrictMode>
);
}

0 comments on commit 532b1d9

Please sign in to comment.