Use createRoot in classic product editor cases (#48834)
mothra mothra mothra
This commit is contained in:
parent
7959060850
commit
e61313b33d
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { render, Suspense, lazy } from '@wordpress/element';
|
||||
import { createRoot, Suspense, lazy } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -20,7 +20,7 @@ if ( metaboxContainer ) {
|
|||
const initialSelected = getSelectedCategoryData(
|
||||
metaboxContainer.parentElement
|
||||
);
|
||||
render(
|
||||
createRoot( metaboxContainer ).render(
|
||||
<Suspense fallback={ null }>
|
||||
<CategoryMetabox initialSelected={ initialSelected } />
|
||||
</Suspense>,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { render } from '@wordpress/element';
|
||||
// @ts-expect-error -- @wordpress/element doesn't export createRoot until WP6.2
|
||||
// eslint-disable-next-line @woocommerce/dependency-group
|
||||
import { createRoot } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -10,4 +12,5 @@ import { ProductTour } from '../../guided-tours/add-product-tour/index';
|
|||
|
||||
const root = document.createElement( 'div' );
|
||||
root.setAttribute( 'id', 'product-tour-root' );
|
||||
render( <ProductTour />, document.body.appendChild( root ) );
|
||||
|
||||
createRoot( document.body.appendChild( root ) ).render( <ProductTour /> );
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { render } from '@wordpress/element';
|
||||
// @ts-expect-error -- @wordpress/element doesn't export createRoot until WP6.2
|
||||
// eslint-disable-next-line @woocommerce/dependency-group
|
||||
import { createRoot } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -10,4 +12,7 @@ import { VariableProductTour } from '../../guided-tours/variable-product-tour';
|
|||
|
||||
const root = document.createElement( 'div' );
|
||||
root.setAttribute( 'id', 'variable-product-tour-root' );
|
||||
render( <VariableProductTour />, document.body.appendChild( root ) );
|
||||
|
||||
createRoot( document.body.appendChild( root ) ).render(
|
||||
<VariableProductTour />
|
||||
);
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Changed from using React.render to React.createRoot for product editor areas as it has been deprecated since React 18
|
Loading…
Reference in New Issue