Home / File/ reordering-across-blocks.js — react Source File

reordering-across-blocks.js — react Source File

Architecture documentation for reordering-across-blocks.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  3996b5a6_df14_ebe1_bd7a_148f82e83e3d["reordering-across-blocks.js"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  3996b5a6_df14_ebe1_bd7a_148f82e83e3d --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 3996b5a6_df14_ebe1_bd7a_148f82e83e3d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {Stringify} from 'shared-runtime';

function Component({config}) {
  /**
   * The original memoization is optimal in the sense that it has
   * one output (the object) and one dependency (`config`). Both
   * the `a` and `b` functions will have to be recreated whenever
   * `config` changes, cascading to update the object.
   *
   * However, we currently only consider consecutive scopes for
   * merging, so we first see the `a` scope, then the `b` scope,
   * and see that the output of the `a` scope is used later -
   * so we don't merge these scopes, and so on.
   *
   * The more optimal thing would be to build a dependency graph
   * of scopes so that we can see the data flow is along the lines
   * of:
   *
   *             config
   *            /      \
   *          [a]      [b]
   *           \       /
   *           [object]
   *
   * All the scopes (shown in []) are transitively dependent on
   * `config`, so they can be merged.
   */
  const object = useMemo(() => {
    const a = event => {
      config?.onA?.(event);
    };

    const b = event => {
      config?.onB?.(event);
    };

    return {
      b,
      a,
    };
  }, [config]);

  return <Stringify value={object} />;
}

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

What does reordering-across-blocks.js do?
reordering-across-blocks.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 reordering-across-blocks.js?
reordering-across-blocks.js defines 1 function(s): Component.
What does reordering-across-blocks.js depend on?
reordering-across-blocks.js imports 1 module(s): shared-runtime.
Where is reordering-across-blocks.js in the architecture?
reordering-across-blocks.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reordering-across-blocks.js (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