Skip to content

[compiler][wip] Extend ValidateNoDerivedComputationsInEffects for props derived effects#122

Draft
everettbu wants to merge 2 commits into
mainfrom
pr34140
Draft

[compiler][wip] Extend ValidateNoDerivedComputationsInEffects for props derived effects#122
everettbu wants to merge 2 commits into
mainfrom
pr34140

Conversation

@everettbu

@everettbu everettbu commented Dec 12, 2025

Copy link
Copy Markdown

Mirror of facebook/react#34140
Original author: poteto


This PR adds infra to disambiguate between two types of derived state in effects:

  1. State derived from props
  2. State derived from other state

TODO:

  • Props tracking through destructuring and property access does not seem to be propagated correctly inside of Functions' instructions (or i might be misunderstanding how we track aliasing effects)
  • compiler/packages/babel-plugin-react-compiler/src/tests/fixtures/compiler/useEffect/invalid-derived-state-from-props-computed.js should be failing
  • Handle "mixed" case where deps flow from at least one prop AND state. Should probably have a different error reason, to aid with categorization

Stack created with Sapling. Best reviewed with ReviewStack.

  • -> #34140
  • #34139

poteto added 2 commits August 13, 2025 09:28
Adds some new test cases for ValidateNoDerivedComputationsInEffects.
…ps derived effects

This PR adds infra to disambiguate between two types of derived state in effects:
  1. State derived from props
  2. State derived from other state

TODO:
- [ ] Props tracking through destructuring and property access does not seem to be propagated correctly inside of Functions' instructions (or i might be misunderstanding how we track aliasing effects)
- [ ] compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useEffect/invalid-derived-state-from-props-computed.js should be failing
- [ ] Handle "mixed" case where deps flow from at least one prop AND state. Should probably have a different error reason, to aid with categorization
@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants