-
Notifications
You must be signed in to change notification settings - Fork 426
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
chore: setup react compiler test and linting #6730
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated May 22, 2024 2:06 PM (UTC)
|
a7eccce
to
48960a5
Compare
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
48960a5
to
39f853f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes makes sense to me, probably need a rebase?
39f853f
to
bf9606f
Compare
Description
Adds support for the React Compiler in the
test-next-studio
. Also adds theeslint-plugin-react-compiler
plugin, which warns us about areas in the codebase that the compiler will skip due to either breaking the rule of hooks, or the code being structured in a way where deps can't be inferred.Components that are memoized by the Compiler gets their own little sparkly badge in the React Devtools extension:
Why add the Compiler? Even though we can't fully reap the benefits of it until we're ready to drop react v18 and make v19 the new baseline, it's useful to be able to track how much perf is improved by the Compiler.
It's also usually a good thing for react v18 perf to refactor the codebase to fix hooks bugs, and to make the code structured so the compiler can fully understand it and optimize it.
We won't see a huge difference right away, as our codebase are in a state that's the combination of:
a) components that would benefit the most from the compiler is currently skipped by it (see
pnpm check:react-compiler
and errors fromreact-compiler/react-compiler
to see which ones, for example )b) most of the components that can be optimized by react-compiler and see a boost are already optimized by hand with
useMemo
,useCallback
andmemo
.We can work on a) over time and it benefits react v18 users as well as v19. While b) is something we can reap once we make v19 the baseline and we can delete all handwritten
useMemo
,useCallback
andmemo
instances 🙌What to review
The change in
useSyncValue
should be fine, as it's functionally equivalent it's only refactored so it can be understood by the compiler.Testing
Existing tests should suffice, it only affects the
dev/test-next-studio
project. There's also a new CI check that tells us if the compiler can run on the full codebase or not.Notes for release
N/A