Update base for Update on "compiler: treat pruned scope outputs as reactive"
Mostly addresses the issue with non-reactive pruned scopes. Before, values from pruned scopes would not be memoized, but could still be depended upon by downstream scopes. However, those downstream scopes would assume the value could never change. This could allow the developer to observe two different versions of a value - the freshly created one (if observed outside a scope) or a cached one (if observed inside, or through) a scope which used the value but didn't depend on it. The fix here is to consider the outputs of pruned reactive scopes as reactive. Note that this is a partial fix because of things like control variables — the full solution would be to mark these values as reactive, and then re-run InferReactivePlaces. We can do this once we've fully converted our pipeline to use HIR everywhere. For now, this should fix most issues in practice because PruneNonReactiveDependencies already does basic alias tracking (see new fixture). [ghstack-poisoned]
Showing
- compiler/packages/babel-plugin-react-compiler/src/Inference/InferReferenceEffects.ts 14 additions, 2 deletions...gin-react-compiler/src/Inference/InferReferenceEffects.ts
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx-indirect.expect.md 109 additions, 0 deletions...mutating-ref-in-callback-passed-to-jsx-indirect.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx-indirect.tsx 28 additions, 0 deletions...allow-mutating-ref-in-callback-passed-to-jsx-indirect.tsx
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx.expect.md 94 additions, 0 deletions...er/allow-mutating-ref-in-callback-passed-to-jsx.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx.tsx 24 additions, 0 deletions...compiler/allow-mutating-ref-in-callback-passed-to-jsx.tsx
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx-indirect.expect.md 109 additions, 0 deletions...ref-property-in-callback-passed-to-jsx-indirect.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx-indirect.tsx 28 additions, 0 deletions...ating-ref-property-in-callback-passed-to-jsx-indirect.tsx
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx.expect.md 94 additions, 0 deletions...mutating-ref-property-in-callback-passed-to-jsx.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx.tsx 24 additions, 0 deletions...allow-mutating-ref-property-in-callback-passed-to-jsx.tsx
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-disallow-mutating-ref-in-render.expect.md 28 additions, 0 deletions...r/error.invalid-disallow-mutating-ref-in-render.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-disallow-mutating-ref-in-render.js 7 additions, 0 deletions...compiler/error.invalid-disallow-mutating-ref-in-render.js
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-disallow-mutating-refs-in-render-transitive.expect.md 35 additions, 0 deletions...lid-disallow-mutating-refs-in-render-transitive.expect.md
- compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-disallow-mutating-refs-in-render-transitive.js 12 additions, 0 deletions...or.invalid-disallow-mutating-refs-in-render-transitive.js
- compiler/packages/snap/src/runner-watch.ts 2 additions, 2 deletionscompiler/packages/snap/src/runner-watch.ts
- compiler/scripts/release/publish-manual.js 5 additions, 6 deletionscompiler/scripts/release/publish-manual.js
- fixtures/flight/config/webpack.config.js 2 additions, 1 deletionfixtures/flight/config/webpack.config.js
- fixtures/flight/server/region.js 25 additions, 7 deletionsfixtures/flight/server/region.js
- fixtures/flight/src/index.js 5 additions, 1 deletionfixtures/flight/src/index.js
- packages/react-client/src/ReactFlightClient.js 51 additions, 10 deletionspackages/react-client/src/ReactFlightClient.js
- packages/react-devtools-shared/src/__tests__/store-test.js 5 additions, 6 deletionspackages/react-devtools-shared/src/__tests__/store-test.js
Please register or sign in to comment