useCallback-extended-contextvar-scope.tsx — react Source File
Architecture documentation for useCallback-extended-contextvar-scope.tsx, a tsx file in the react codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4c472bb2_cccd_d9fe_a330_d384d1ab2354["useCallback-extended-contextvar-scope.tsx"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 4c472bb2_cccd_d9fe_a330_d384d1ab2354 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"] 4c472bb2_cccd_d9fe_a330_d384d1ab2354 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05 style 4c472bb2_cccd_d9fe_a330_d384d1ab2354 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @validatePreserveExistingMemoizationGuarantees:true
import {useCallback} from 'react';
import {Stringify, useIdentity} from 'shared-runtime';
/**
* Here, the *inferred* dependencies of cb are `a` and `t1 = LoadContext capture x_@1`.
* - t1 does not have a scope as it captures `x` after x's mutable range
* - `x` is a context variable, which means its mutable range extends to all
* references / aliases.
* - `a`, `b`, and `x` get the same mutable range due to potential aliasing.
*
* We currently bail out because `a` has a scope and is not transitively memoized
* (as its scope is pruned due to a hook call)
*/
function useBar({a, b}, cond) {
let x = useIdentity({val: 3});
if (cond) {
x = b;
}
const cb = useCallback(() => {
return [a, x];
}, [a, x]);
return <Stringify cb={cb} shouldInvoke={true} />;
}
export const FIXTURE_ENTRYPOINT = {
fn: useBar,
params: [{a: 1, b: 2}, true],
};
Domain
Subdomains
Functions
Dependencies
- react
- shared-runtime
Source
Frequently Asked Questions
What does useCallback-extended-contextvar-scope.tsx do?
useCallback-extended-contextvar-scope.tsx is a source file in the react codebase, written in tsx. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in useCallback-extended-contextvar-scope.tsx?
useCallback-extended-contextvar-scope.tsx defines 1 function(s): useBar.
What does useCallback-extended-contextvar-scope.tsx depend on?
useCallback-extended-contextvar-scope.tsx imports 2 module(s): react, shared-runtime.
Where is useCallback-extended-contextvar-scope.tsx in the architecture?
useCallback-extended-contextvar-scope.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-extended-contextvar-scope.tsx (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free