Home / File/ ReactOwnerStackReset.js — react Source File

ReactOwnerStackReset.js — react Source File

Architecture documentation for ReactOwnerStackReset.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript BabelCompiler Entrypoint 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  34486a0a_16ea_d79d_a759_4489503ba160["ReactOwnerStackReset.js"]
  1c5695a6_6806_ba54_2074_efc779e66da4["ReactSharedInternals"]
  34486a0a_16ea_d79d_a759_4489503ba160 --> 1c5695a6_6806_ba54_2074_efc779e66da4
  style 34486a0a_16ea_d79d_a759_4489503ba160 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and its 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 ReactSharedInternals from 'shared/ReactSharedInternals';

let lastResetTime = 0;

let getCurrentTime: () => number | DOMHighResTimeStamp;
const hasPerformanceNow =
  // $FlowFixMe[method-unbinding]
  typeof performance === 'object' && typeof performance.now === 'function';

if (hasPerformanceNow) {
  const localPerformance = performance;
  getCurrentTime = () => localPerformance.now();
} else {
  const localDate = Date;
  getCurrentTime = () => localDate.now();
}

export function resetOwnerStackLimit() {
  if (__DEV__) {
    const now = getCurrentTime();
    const timeSinceLastReset = now - lastResetTime;
    if (timeSinceLastReset > 1000) {
      ReactSharedInternals.recentlyCreatedOwnerStacks = 0;
      lastResetTime = now;
    }
  } else {
    // These errors should never make it into a build so we don't need to encode them in codes.json
    // eslint-disable-next-line react-internal/prod-error-codes
    throw new Error(
      'resetOwnerStackLimit should never be called in production mode. This is a bug in React.',
    );
  }
}

Domain

Subdomains

Dependencies

  • ReactSharedInternals

Frequently Asked Questions

What does ReactOwnerStackReset.js do?
ReactOwnerStackReset.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in ReactOwnerStackReset.js?
ReactOwnerStackReset.js defines 2 function(s): getCurrentTime, resetOwnerStackLimit.
What does ReactOwnerStackReset.js depend on?
ReactOwnerStackReset.js imports 1 module(s): ReactSharedInternals.
Where is ReactOwnerStackReset.js in the architecture?
ReactOwnerStackReset.js is located at packages/shared/ReactOwnerStackReset.js (domain: BabelCompiler, subdomain: Entrypoint, directory: packages/shared).

Analyze Your Own Codebase

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

Try Supermodel Free