chore(poc): react19 & compiler #20314
Draft
+673
−239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do?
This is POC to show off some of how react19 looks in Strapi and optionally, show the ability for us to use the
react-compiler
. You can enable the compiler by settingUSE_REACT_COMPILER=true
in your.env
file! It's only set up forvite
since we've deprecatedwebpack
.There's some bugs in how the design-system interacts with refs and the DOM which are being phased out in the DSv2 work anyway, so unfortunately something like the
list-view
in the CM doesn't work. Additionally, one big thing the compiler pointed out usingnpx react-compiler-healthcheck
was:Most of the components can be optimised! The main issue across the admin is our
createContext
function but we can fix this by probably removing it and implementing some guidelines on working with context in a similar way. The other biggest highlight wascontent-type-builder
which has very poor health. Primarily down to the fact the data-fetching is all done in effects with refs (boo) this is something on our roadmap for a while though. Similarly, the app won't load with the plugins initialiser, but this can block the entire app from rendering so to be honest we should just get rid of it anyway and deprecate the methods in v5 lifecycle.Overall, the transition doesn't look painful to use
react@19
, we should focus on the DS being easily compatible with the primary change of not needing to useforwardRef
(woo) but we could do a v3 for the DS and upgrade the app at the same time. Hopefully when v2 is released we'll be able to use the entire CMS with react19 to test and play with 🥳Notes