Commit e7a3c5c
committed
[compiler] enablePreserveMemo treats manual deps as non-nullable (#34503)
The `@enablePreserveExistingMemoizationGuarantees` mode can still fail
to preserve manual memoization due to mismtached dependencies.
Specifically, where the user's dependencies are more precise than the
compiler infers bc the compiler is being conservative about what might
be nullable. In this mode though we're intentionally using information
from the manual memoization and can also rely on the deps as a signal
for what's non-nullable.
The idea of the PR is that we treat manual memo deps just like other
inferred-as-non-nullable objects during PropagateScopeDeps. We're
careful to not treat the full path as non-nullable, only up to the last
property index. So `x.y.z` as a manual dep treats `x` and `x.y` as
non-nullable, allowing us to preserve a conditional dependency on
`x.y.z`.
Optionals within manual dependencies are a bit trickier and aren't
handled yet, but hopefully that's less common and something we can
improve in a follow-up. Not handling them just means that developers may
hit false positives on validating existing memoization if they use
optional chains in manual dependencies.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34503).
* #34689
* __->__ #34503
DiffTrain build for [57d5a59](57d5a59)1 parent 87f0469 commit e7a3c5c
File tree
35 files changed
+109
-86
lines changed- compiled
- eslint-plugin-react-hooks
- facebook-www
35 files changed
+109
-86
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45363 | 45363 | | |
45364 | 45364 | | |
45365 | 45365 | | |
| 45366 | + | |
| 45367 | + | |
| 45368 | + | |
| 45369 | + | |
| 45370 | + | |
| 45371 | + | |
| 45372 | + | |
| 45373 | + | |
| 45374 | + | |
| 45375 | + | |
| 45376 | + | |
| 45377 | + | |
| 45378 | + | |
| 45379 | + | |
| 45380 | + | |
| 45381 | + | |
| 45382 | + | |
| 45383 | + | |
| 45384 | + | |
| 45385 | + | |
| 45386 | + | |
| 45387 | + | |
| 45388 | + | |
45366 | 45389 | | |
45367 | 45390 | | |
45368 | 45391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
| 1461 | + | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
1461 | | - | |
| 1461 | + | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20303 | 20303 | | |
20304 | 20304 | | |
20305 | 20305 | | |
20306 | | - | |
| 20306 | + | |
20307 | 20307 | | |
20308 | 20308 | | |
20309 | | - | |
| 20309 | + | |
20310 | 20310 | | |
20311 | 20311 | | |
20312 | 20312 | | |
| |||
20341 | 20341 | | |
20342 | 20342 | | |
20343 | 20343 | | |
20344 | | - | |
| 20344 | + | |
20345 | 20345 | | |
20346 | 20346 | | |
20347 | 20347 | | |
| |||
0 commit comments