Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 894 forks source link

WP 6.2 compatibility: use React `createRoot` #19858

Open igorschoester opened 1 year ago

igorschoester commented 1 year ago

⚠️ Since we rely on @wordpress/element to export createRoot -- this issue can not be fixed until WP 6.2 is the last version we support (unless we try both methods) ⚠️

In WP 6.2 we get React 18.0.2 instead of 17.0.2.

This causes JS console errors to be shown:

Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

This seems to originate in a couple of different places, like the help scout beacon, first time configuration and the settings (not Settings UI).

Reproduce steps

igorschoester commented 1 year ago

Situation

Dependencies (TODO)

Tests are failing (TODO)

Possible solution?

Addons (TODO)

enricobattocchi commented 1 year ago

Moved to the most future sprint we currently have, we'll reprise it by then and try to plan a clear timeline

shabnam611 commented 1 year ago

Please inform the customer of conversation # 1054366 when this conversation has been closed.

pixeline commented 1 year ago

Issue is still active with latest yoast premium. Any ETA ?

ogodoabiola commented 9 months ago

Please inform the customer of conversation # 1103708 when this conversation has been closed.

helgatheviking commented 9 months ago

Was googling for something else and ended up here. If I am reading this correctly I have been supporting both versions like so:

/**
 * External dependencies
 */
import { createRoot, render } from '@wordpress/element';
import App from './app';

const target = document.getElementById( 'my-app-root' );

if ( target ) {

    if ( createRoot ) {
        createRoot( target ).render( <App /> );
    } else {
        render( <App />, target );
    }
}

If createRoot() exists (like in the newer react) it uses that. If createRoot() is undefined... it falls back to render()

josevarghese commented 9 months ago

Hi @helgatheviking

Thanks for the comment and for sharing more details. This issue is on the radar of our development team, and they will prioritize it based on the severity of this problem in relation to other open bug reports and new features.

neoseeyou commented 5 months ago

Still not corrected?

EverStarck commented 1 month ago

we are on WP 6.6, any updates on this?