Home / File/ profilingCommitTreeBuilder-test.js — react Source File

profilingCommitTreeBuilder-test.js — react Source File

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

Entity Profile

Dependency Diagram

graph LR
  1a06e083_1d01_6482_4cb2_bd04eeb98167["profilingCommitTreeBuilder-test.js"]
  7ea1760e_9c01_71c9_3ba5_32a9a10a0ce4["utils.js"]
  1a06e083_1d01_6482_4cb2_bd04eeb98167 --> 7ea1760e_9c01_71c9_3ba5_32a9a10a0ce4
  baf70b0e_4867_b3ed_962a_e5c9ae820fef["store"]
  1a06e083_1d01_6482_4cb2_bd04eeb98167 --> baf70b0e_4867_b3ed_962a_e5c9ae820fef
  style 1a06e083_1d01_6482_4cb2_bd04eeb98167 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type Store from 'react-devtools-shared/src/devtools/store';

import {getVersionedRenderImplementation} from './utils';

describe('commit tree', () => {
  let React = require('react');
  let Scheduler;
  let store: Store;
  let utils;

  beforeEach(() => {
    utils = require('./utils');
    utils.beforeEachProfiling();

    store = global.store;
    store.collapseNodesByDefault = false;
    store.recordChangeDescriptions = true;

    React = require('react');
    Scheduler = require('scheduler');
  });

  const {render} = getVersionedRenderImplementation();

  // @reactVersion >= 16.9
  it('should be able to rebuild the store tree for each commit', () => {
    const Parent = ({count}) => {
      Scheduler.unstable_advanceTime(10);
      return new Array(count)
        .fill(true)
        .map((_, index) => <Child key={index} />);
    };
    const Child = React.memo(function Child() {
      Scheduler.unstable_advanceTime(2);
      return null;
    });

    utils.act(() => store.profilerStore.startProfiling());
    utils.act(() => render(<Parent count={1} />));
    expect(store).toMatchInlineSnapshot(`
      [root]
        ▾ <Parent>
            <Child key="0"> [Memo]
    `);
    utils.act(() => render(<Parent count={3} />));
    expect(store).toMatchInlineSnapshot(`
      [root]
        ▾ <Parent>
            <Child key="0"> [Memo]
            <Child key="1"> [Memo]
            <Child key="2"> [Memo]
// ... (204 more lines)

Domain

Dependencies

Frequently Asked Questions

What does profilingCommitTreeBuilder-test.js do?
profilingCommitTreeBuilder-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does profilingCommitTreeBuilder-test.js depend on?
profilingCommitTreeBuilder-test.js imports 2 module(s): store, utils.js.
Where is profilingCommitTreeBuilder-test.js in the architecture?
profilingCommitTreeBuilder-test.js is located at packages/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder-test.js (domain: BabelCompiler, directory: packages/react-devtools-shared/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free