Skip to content

Commit d2b76b8

Browse files
committed
Update base for Update on "[compiler] Infer optional dependencies (behind feature flag)"
Adds a new feature flag, `enableOptionalDependencies` which when enabled allows PropagateScopeDeps and DeriveMinimalDeps to infer optional dependency paths (`a?.b`). In PropagateScopeDeps we look for specific safe patterns of nested optional member expressions: * `<variable> "." / "?." <property>` * or `<nested> "." / "?." <property>` When we find this pattern we record a dependency on the overall chain, so for example in `a?.b.c?.d.map()` we would record a dependency on `a?.b.c?.d` (because the outer `.map()` portion doesn't match the above structure). If the structure doesn't match - for example with `a?.b?.[foo(bar)]?.z` - then we fall back to the existing behavior which treats everything after the initial portion as conditional (for that last example we'd continue to record `a` as the dep). The other portion is DeriveMinimalDeps, which now represents optional access/dependency states and updates the merge logic to handle them. The order of precedence is unconditional > optional > conditional. Note: the flag is off by default, but i tried enabling it for all fixtures and the results were all either unchanged or had correct optional deps inferred. I'll also try running it internally with the flag enabled, but i think we can proceed with review and fix-forward any issues identified from that testing. [ghstack-poisoned]
1 parent 77a0bb6 commit d2b76b8

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import {CompilerError} from '..';
99
import {
1010
DeclarationId,
11-
DependencyPath,
1211
InstructionId,
1312
InstructionKind,
1413
Place,

0 commit comments

Comments
 (0)