From 736121fac2977be98db294fe51421d96c8526993 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Tue, 4 Jun 2024 15:56:31 +0400 Subject: [PATCH] Re-enable React StrictMode (#61943) Co-authored-by: Mamaduka Co-authored-by: youknowriad Co-authored-by: tyxla Co-authored-by: kevin940726 Co-authored-by: ellatrix --- packages/customize-widgets/src/index.js | 14 ++++++++------ packages/edit-post/src/index.js | 16 +++++++++------- packages/edit-site/src/index.js | 8 ++++++-- packages/edit-widgets/src/index.js | 8 ++++++-- packages/list-reusable-blocks/src/index.js | 6 ++++-- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/packages/customize-widgets/src/index.js b/packages/customize-widgets/src/index.js index 9afda775a1701..5de010fa8bd37 100644 --- a/packages/customize-widgets/src/index.js +++ b/packages/customize-widgets/src/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { createRoot } from '@wordpress/element'; +import { createRoot, StrictMode } from '@wordpress/element'; import { registerCoreBlocks, __experimentalGetCoreBlocks, @@ -92,11 +92,13 @@ export function initialize( editorName, blockEditorSettings ) { } ); createRoot( container ).render( - + + + ); } ); } diff --git a/packages/edit-post/src/index.js b/packages/edit-post/src/index.js index 0ec4388a9af70..e7600831f11ba 100644 --- a/packages/edit-post/src/index.js +++ b/packages/edit-post/src/index.js @@ -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 { @@ -137,12 +137,14 @@ export function initializeEditor( window.addEventListener( 'drop', ( e ) => e.preventDefault(), false ); root.render( - + + + ); return root; diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js index 41fc0a1985fde..f7ef09f81ce7e 100644 --- a/packages/edit-site/src/index.js +++ b/packages/edit-site/src/index.js @@ -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 { @@ -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( ); + root.render( + + + + ); return root; } diff --git a/packages/edit-widgets/src/index.js b/packages/edit-widgets/src/index.js index 2374ec19dabd7..f8247d733f1a1 100644 --- a/packages/edit-widgets/src/index.js +++ b/packages/edit-widgets/src/index.js @@ -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, @@ -91,7 +91,11 @@ export function initializeEditor( id, settings ) { // see: https://github.com/WordPress/gutenberg/issues/33097 setFreeformContentHandlerName( 'core/html' ); - root.render( ); + root.render( + + + + ); return root; } diff --git a/packages/list-reusable-blocks/src/index.js b/packages/list-reusable-blocks/src/index.js index 4440ba1c49f05..f5cb411726963 100644 --- a/packages/list-reusable-blocks/src/index.js +++ b/packages/list-reusable-blocks/src/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { createRoot } from '@wordpress/element'; +import { createRoot, StrictMode } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; /** @@ -44,6 +44,8 @@ document.addEventListener( 'DOMContentLoaded', () => { container.className = 'list-reusable-blocks__container'; button.parentNode.insertBefore( container, button ); createRoot( container ).render( - + + + ); } );