Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate all React functionality to use @wordpress/element with dependency extraction #2613

Closed
JakePT opened this issue Feb 25, 2022 · 1 comment · Fixed by #2756
Closed
Assignees
Labels
enhancement front end Issues mostly related to the Front End like JavaScript/React and CSS.
Milestone

Comments

@JakePT
Copy link
Contributor

JakePT commented Feb 25, 2022

Is your enhancement related to a problem? Please describe.
Instant Results, introduced in 4.x, is powered by the version of React included in WordPress by importing @wordpress/element with the WordPress dependency extraction plugin enabled. However the Synonyms editor uses a (now) older version of React that is included as an NPM dependency of the plugin.

During the development of Instant Results several React related bugs would occur when building assets with npm run watch. A possible cause of this issue is a mismatch between the version of React in WordPress and the version used as a dependency of other features. For this reason, as well as consistency and reducing the number of dependencies, I propose migrating all React-based features in the plugin to using @wordpress/element with dependency extraction.

Describe the solution you'd like

  • Update the Synonyms feature to use @wordpress/element with dependency extraction instead of a separate React dependency.
  • Remove unused React dependencies from the plugin.

Best case scenario this will be a handful of lines worth of changes to the import statements and package.json dependencies, but the results will need to be tested.

Describe alternatives you've considered
A solution could be to go in the other direction, and use our own React dependency for these features instead of what's included in WordPress, but the trouble with that approach is that with its current implementation Instant Results uses other WordPress libraries built on top of @wordpress/element, such as SlotFills, that will require whichever version of React is included in WordPress.

@JakePT JakePT self-assigned this Feb 25, 2022
@JakePT
Copy link
Contributor Author

JakePT commented Mar 4, 2022

As noticed on #2631, custom search results will need to replace react-beautiful-dnd before it can be updated to use the version of React in WordPress, which is no longer compatible as of 5.9.

@felipeelia felipeelia added the front end Issues mostly related to the Front End like JavaScript/React and CSS. label Mar 31, 2022
@felipeelia felipeelia added this to the 4.2.0 milestone May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement front end Issues mostly related to the Front End like JavaScript/React and CSS.
Projects
None yet
2 participants