Home / File/ nonreactive-dep.js — react Source File

nonreactive-dep.js — react Source File

Architecture documentation for nonreactive-dep.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  a5631fea_2192_dc46_08da_f70734b9c694["nonreactive-dep.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  a5631fea_2192_dc46_08da_f70734b9c694 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  a5631fea_2192_dc46_08da_f70734b9c694 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style a5631fea_2192_dc46_08da_f70734b9c694 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @inferEffectDependencies
import {useEffect, AUTODEPS} from 'react';
import {makeObject_Primitives, print} from 'shared-runtime';

/**
 * Note that `obj` is currently added to the effect dependency array, even
 * though it's non-reactive due to memoization.
 *
 * This is a TODO in effect dependency inference. Note that we cannot simply
 * filter out non-reactive effect dependencies, as some non-reactive (by data
 * flow) values become reactive due to scope pruning. See the
 * `infer-effect-deps/pruned-nonreactive-obj` fixture for why this matters.
 *
 * Realizing that this `useEffect` should have an empty dependency array
 * requires effect dependency inference to be structured similarly to memo
 * dependency inference.
 * Pass 1: add all potential dependencies regardless of dataflow reactivity
 * Pass 2: (todo) prune non-reactive dependencies
 *
 * Note that instruction reordering should significantly reduce scope pruning
 */
function NonReactiveDepInEffect() {
  const obj = makeObject_Primitives();
  useEffect(() => print(obj), AUTODEPS);
}

Subdomains

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does nonreactive-dep.js do?
nonreactive-dep.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in nonreactive-dep.js?
nonreactive-dep.js defines 1 function(s): NonReactiveDepInEffect.
What does nonreactive-dep.js depend on?
nonreactive-dep.js imports 2 module(s): react, shared-runtime.
Where is nonreactive-dep.js in the architecture?
nonreactive-dep.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-effect-dependencies/nonreactive-dep.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-effect-dependencies).

Analyze Your Own Codebase

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

Try Supermodel Free