dillon1000/react
Commit
Browse files Extend effect dep validation to handle pruned memoization
Extends the validation that effect deps are memoized to handle an additional case that @gsathya pointed out: when a dependency has a reactive scope but that scope ends up being pruned. We track reactive scopes which actually exist in the ReactiveFunction, and reject useEffect deps that have an associated reactive scope but where that scope does not exist (bc it got pruned).
Changed paths8 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/HIR/HIR.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/Validation/ValidateMemoizedEffectDependencies.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useEffect-dep-not-memoized-bc-range-overlaps-hook.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.invalid-useEffect-dep-not-memoized-bc-range-overlaps-hook.js AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merged-scopes-are-valid-effect-deps.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/merged-scopes-are-valid-effect-deps.js AddedPatch
Files changed
Rendering syntax-highlighted changes…