Home / Function/ wrapCacheDep() — react Function Reference

wrapCacheDep() — react Function Reference

Architecture documentation for the wrapCacheDep() function in CodegenReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  93513a6b_e98a_59dd_9d2d_7756ef0a1fc0["wrapCacheDep()"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  93513a6b_e98a_59dd_9d2d_7756ef0a1fc0 -->|defined in| dc7f10c2_c914_a162_d02b_a10a15c64a5f
  94638464_4710_0693_528f_4848cf25e876["codegenReactiveScope()"]
  94638464_4710_0693_528f_4848cf25e876 -->|calls| 93513a6b_e98a_59dd_9d2d_7756ef0a1fc0
  5228ee8c_dc7c_d859_3f41_614fd9c00374["unwrap()"]
  93513a6b_e98a_59dd_9d2d_7756ef0a1fc0 -->|calls| 5228ee8c_dc7c_d859_3f41_614fd9c00374
  style 93513a6b_e98a_59dd_9d2d_7756ef0a1fc0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts lines 577–599

function wrapCacheDep(cx: Context, value: t.Expression): t.Expression {
  if (
    cx.env.config.enableEmitFreeze != null &&
    cx.env.outputMode === 'client'
  ) {
    const emitFreezeIdentifier = cx.env.programContext.addImportSpecifier(
      cx.env.config.enableEmitFreeze,
    ).name;
    cx.env.programContext
      .assertGlobalBinding(EMIT_FREEZE_GLOBAL_GATING, cx.env.scope)
      .unwrap();
    return t.conditionalExpression(
      t.identifier(EMIT_FREEZE_GLOBAL_GATING),
      t.callExpression(t.identifier(emitFreezeIdentifier), [
        value,
        t.stringLiteral(cx.fnName),
      ]),
      value,
    );
  } else {
    return value;
  }
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does wrapCacheDep() do?
wrapCacheDep() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts.
Where is wrapCacheDep() defined?
wrapCacheDep() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts at line 577.
What does wrapCacheDep() call?
wrapCacheDep() calls 1 function(s): unwrap.
What calls wrapCacheDep()?
wrapCacheDep() is called by 1 function(s): codegenReactiveScope.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free