Commit 04927c2
committed
[Compiler] Change ValidateNoDerivedComputationsInEffect logic to track prop and local state derived values variables and add extra tests
Summary:
Biggest change of the stack, we track how values prop and local state values are derived throughout the entire component.
We are iterating over instructions instead of effects since some mutations can not be caught otherwise.
For every derivation we track the type of value its coming from (props or local state) and also the top most relevant sources (These would be the ones that are actually named instead of promoted like t0)
We propagate these relevant sources to each derivation.
This allows us to catch more complex useEffects though right now we are overcapturing some more complex cases which will be refined further up the stack.
This PR also adds a couple tests we will work towards fixing
Test Plan:
Added:
ref-conditional-in-effect-no-error
effect-contains-prop-function-call-no-error
derived-state-from-ref-and-state-no-error1 parent 1d9ccd1 commit 04927c2
File tree
28 files changed
+716
-858
lines changed- compiler/packages/babel-plugin-react-compiler/src
- Validation
- __tests__/fixtures/compiler/effect-derived-computations
28 files changed
+716
-858
lines changedLines changed: 306 additions & 154 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 0 additions & 70 deletions
This file was deleted.
This file was deleted.
0 commit comments