repro-invalid-pruned-scope-leaks-value.ts — react Source File
Architecture documentation for repro-invalid-pruned-scope-leaks-value.ts, a typescript file in the react codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7ca450ae_3436_d3aa_e097_8667f3a3e5b0["repro-invalid-pruned-scope-leaks-value.ts"] 7b0f5d46_efcb_4a2d_89c1_7cee4a0f9bc8["invariant"] 7ca450ae_3436_d3aa_e097_8667f3a3e5b0 --> 7b0f5d46_efcb_4a2d_89c1_7cee4a0f9bc8 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"] 7ca450ae_3436_d3aa_e097_8667f3a3e5b0 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05 style 7ca450ae_3436_d3aa_e097_8667f3a3e5b0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import invariant from 'invariant';
import {makeObject_Primitives, mutate, sum, useIdentity} from 'shared-runtime';
/**
* Here, `z`'s original memo block is removed due to the inner hook call.
* However, we also infer that `z` is non-reactive, so by default we would create
* the memo block for `thing = [y, z]` as only depending on `y`.
*
* This could then mean that `thing[1]` and `z` may not refer to the same value,
* since z recreates every time but `thing` doesn't correspondingly invalidate.
*
* The fix is to consider pruned memo block outputs as reactive, since they will
* recreate on every render. This means `thing` depends on both y and z.
*/
function MyApp({count}) {
const z = makeObject_Primitives();
const x = useIdentity(2);
const y = sum(x, count);
mutate(z);
const thing = [y, z];
if (thing[1] !== z) {
invariant(false, 'oh no!');
}
return thing;
}
export const FIXTURE_ENTRYPOINT = {
fn: MyApp,
params: [{count: 2}],
sequentialRenders: [{count: 2}, {count: 2}, {count: 3}],
};
Domain
Subdomains
Functions
Dependencies
- invariant
- shared-runtime
Source
Frequently Asked Questions
What does repro-invalid-pruned-scope-leaks-value.ts do?
repro-invalid-pruned-scope-leaks-value.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in repro-invalid-pruned-scope-leaks-value.ts?
repro-invalid-pruned-scope-leaks-value.ts defines 1 function(s): MyApp.
What does repro-invalid-pruned-scope-leaks-value.ts depend on?
repro-invalid-pruned-scope-leaks-value.ts imports 2 module(s): invariant, shared-runtime.
Where is repro-invalid-pruned-scope-leaks-value.ts in the architecture?
repro-invalid-pruned-scope-leaks-value.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-pruned-scope-leaks-value.ts (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free