-
Notifications
You must be signed in to change notification settings - Fork 50k
[compiler][poc] Reuse ValidateExhaustiveDeps for effect dep validation #35285
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
+924
−303
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alternative approach to #35282 for validating effect deps in the compiler that builds on the machinery in ValidateExhaustiveDependencies. Key changes to that pass: * Refactor to track the dependencies of array expressions as temporaries so we can look them up later if they appear as effect deps. * Instead of not storing temporaries for LoadLocals of locally created variables, we store the temporary but also propagate the local-ness through. This allows us to record deps at the top level, necessary for effect deps. Previously the pass was only ever concerned with tracking deps within function expressions. * Refactor the bulk of the dependency-checking logic from `onFinishMemoize()` into a standalone helper to use it for the new `onEffect()` helper as well. A few important remaining todos: * Add a new ErrorCategory for effect deps, use it for errors on effects * Put the effect dep validation behind a feature flag * Adjust the error reason for effect errors Testing it locally on fixtures this looks ballpark right but i didn't do an exhaustive test.
Member
Author
|
Spot checking the test failures they look mostly legit, lots of cases where our test fixtures have non-exhaustive deps. |
…description for effect dep errors
josephsavona
commented
Dec 4, 2025
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts
Outdated
Show resolved
Hide resolved
josephsavona
commented
Dec 5, 2025
Member
Author
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.
The additional changes look great, nice and clean way to detect effect events.
I can't stamp my own PR but...shipit
compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts
Outdated
Show resolved
Hide resolved
compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts
Show resolved
Hide resolved
compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateExhaustiveDependencies.ts
Outdated
Show resolved
Hide resolved
Member
Author
|
Nice :-) |
github-actions bot
pushed a commit
that referenced
this pull request
Dec 8, 2025
#35285) Alternative approach to #35282 for validating effect deps in the compiler that builds on the machinery in ValidateExhaustiveDependencies. Key changes to that pass: * Refactor to track the dependencies of array expressions as temporaries so we can look them up later if they appear as effect deps. * Instead of not storing temporaries for LoadLocals of locally created variables, we store the temporary but also propagate the local-ness through. This allows us to record deps at the top level, necessary for effect deps. Previously the pass was only ever concerned with tracking deps within function expressions. * Refactor the bulk of the dependency-checking logic from `onFinishMemoize()` into a standalone helper to use it for the new `onEffect()` helper as well. * Add a new ErrorCategory for effect deps, use it for errors on effects * Put the effect dep validation behind a feature flag * Adjust the error reason for effect errors --------- Co-authored-by: Jack Pope <[email protected]> DiffTrain build for [ec9cc00](ec9cc00)
github-actions bot
pushed a commit
that referenced
this pull request
Dec 8, 2025
#35285) Alternative approach to #35282 for validating effect deps in the compiler that builds on the machinery in ValidateExhaustiveDependencies. Key changes to that pass: * Refactor to track the dependencies of array expressions as temporaries so we can look them up later if they appear as effect deps. * Instead of not storing temporaries for LoadLocals of locally created variables, we store the temporary but also propagate the local-ness through. This allows us to record deps at the top level, necessary for effect deps. Previously the pass was only ever concerned with tracking deps within function expressions. * Refactor the bulk of the dependency-checking logic from `onFinishMemoize()` into a standalone helper to use it for the new `onEffect()` helper as well. * Add a new ErrorCategory for effect deps, use it for errors on effects * Put the effect dep validation behind a feature flag * Adjust the error reason for effect errors --------- Co-authored-by: Jack Pope <[email protected]> DiffTrain build for [ec9cc00](ec9cc00)
unstubbable
pushed a commit
to vercel/next.js
that referenced
this pull request
Dec 10, 2025
[diff facebook/react@378973b3...55480b4d](facebook/react@378973b...55480b4) <details> <summary>React upstream changes</summary> - facebook/react#35317 - facebook/react#35306 - facebook/react#35285 - facebook/react#35316 - facebook/react#35313 - facebook/react#35308 - facebook/react#35284 - facebook/react#35296 </details>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Alternative approach to #35282 for validating effect deps in the compiler that builds on the machinery in ValidateExhaustiveDependencies. Key changes to that pass:
onFinishMemoize()into a standalone helper to use it for the newonEffect()helper as well.A few important remaining todos:
Testing it locally on fixtures this looks ballpark right but i didn't do an exhaustive test.
Feel free to commandeer and edit :-)