dillon1000/react

Commit

[compiler] Allow inferred non-optional paths when manual deps were optional

If the inferred deps are more precise (non-optional) than the manual deps (optional) it should pass validation.

The other direction also seems like it would be fine - inferring optional deps when the original was non-optional - but for now let's keep the "at least as precise" rule.

ghstack-source-id: 9f7a99ee5f7caa2c2d96f70f360e4320bac3de2d
Pull Request resolved: https://github.com/facebook/react/pull/30816
Browse files
Changed paths3 files
First-parent comparison
M compiler/packages/babel-plugin-react-compiler/src/Validation/ValidatePreservedManualMemoization.ts ModifiedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep-non-optional-in-body.expect.md AddedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-member-expression-as-memo-dep-non-optional-in-body.js Added
Patch

Files changed

Rendering syntax-highlighted changes…