fix: wcadmin react18 createroot shipping settings, payment method, wc beta tester (#48835)
This commit is contained in:
parent
31c4ae8431
commit
a92fbcaa07
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { render } from '@wordpress/element';
|
||||
import { createRoot } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -10,9 +10,8 @@ import { BetaFeaturesTrackingContainer } from './container';
|
|||
import './style.scss';
|
||||
|
||||
const betaFeaturesRoot = document.createElement( 'div' );
|
||||
betaFeaturesRoot.setAttribute( 'id', 'beta-features-tracking' );
|
||||
|
||||
render(
|
||||
<BetaFeaturesTrackingContainer />,
|
||||
document.body.appendChild( betaFeaturesRoot )
|
||||
betaFeaturesRoot.setAttribute( 'id', 'beta-features-tracking' );
|
||||
createRoot( document.body.appendChild( betaFeaturesRoot ) ).render(
|
||||
<BetaFeaturesTrackingContainer />
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
@ -34,7 +36,7 @@ PAYMENT_METHOD_PROMOTIONS.forEach( ( paymentMethod ) => {
|
|||
);
|
||||
const subTitle = container.getElementsByClassName( 'gateway-subtitle' );
|
||||
|
||||
render(
|
||||
createRoot( container ).render(
|
||||
<PaymentPromotionRow
|
||||
columns={ columns }
|
||||
paymentMethod={ paymentMethod }
|
||||
|
@ -42,8 +44,7 @@ PAYMENT_METHOD_PROMOTIONS.forEach( ( paymentMethod ) => {
|
|||
subTitleContent={
|
||||
subTitle.length === 1 ? subTitle[ 0 ].innerHTML : undefined
|
||||
}
|
||||
/>,
|
||||
container
|
||||
/>
|
||||
);
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { render, createRoot } from '@wordpress/element';
|
||||
import { createRoot } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -24,9 +24,5 @@ const ShippingApp = () => (
|
|||
);
|
||||
|
||||
if ( shippingZoneRegionPickerRoot ) {
|
||||
if ( createRoot ) {
|
||||
createRoot( shippingZoneRegionPickerRoot ).render( <ShippingApp /> );
|
||||
} else {
|
||||
render( <ShippingApp />, shippingZoneRegionPickerRoot );
|
||||
}
|
||||
createRoot( shippingZoneRegionPickerRoot ).render( <ShippingApp /> );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Changed from using React.render to React.createRoot for wc beta tester as it has been deprecated since React 18
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { render } from '@wordpress/element';
|
||||
import { createRoot } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -16,7 +16,7 @@ const appRoot = document.getElementById(
|
|||
);
|
||||
|
||||
if ( appRoot ) {
|
||||
render( <App />, appRoot );
|
||||
createRoot( appRoot ).render( <App /> );
|
||||
}
|
||||
|
||||
registerProductEditorDevTools();
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Changed from using React.render to React.createRoot for payment methods promotion, shipping settings region zone as it has been deprecated since React 18
|
Loading…
Reference in New Issue