dillon1000/react

Commit

[compiler] Add tests for incorrect global mutation detection

If a function expression that mutates a global is passed as a prop,
we don't throw an error as we assume it's not called in render.

But if this function expression is captured in an object and passed down
as prop, we throw an error.

ghstack-source-id: 74cacee09f565550007b2e01fa8877ad64ccfbe9
Pull Request resolved: https://github.com/facebook/react/pull/30456
Browse files
Changed paths2 files
First-parent comparison
A compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.object-capture-global-mutation.expect.md AddedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.object-capture-global-mutation.js Added
Patch

Files changed

Rendering syntax-highlighted changes…