/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
v19.1.0
packages/react/src/ReactSharedInternalsClient.js
67 строк
2 KB
Sebastian "Sebbie" Silbermann
Stop creating Owner Stacks if many have been created recently (#32529)
24 мар 2025, 01:47
Не верифицирован
24 мар 2025, 01:47
4a9df08
Код
Авторство
О чём код?
/** * 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 {Dispatcher} from 'react-reconciler/src/ReactInternalTypes'; import type {AsyncDispatcher} from 'react-reconciler/src/ReactInternalTypes'; import type {BatchConfigTransition} from 'react-reconciler/src/ReactFiberTracingMarkerComponent'; import type {TransitionTypes} from './ReactTransitionType'; export type SharedStateClient = { H: null | Dispatcher, // ReactCurrentDispatcher for Hooks A: null | AsyncDispatcher, // ReactCurrentCache for Cache T: null | BatchConfigTransition, // ReactCurrentBatchConfig for Transitions S: null | ((BatchConfigTransition, mixed) => void), // onStartTransitionFinish V: null | TransitionTypes, // Pending Transition Types for the Next Transition // DEV-only // ReactCurrentActQueue actQueue: null | Array<RendererTask>, // Used to reproduce behavior of `batchedUpdates` in legacy mode. isBatchingLegacy: boolean, didScheduleLegacyUpdate: boolean, // Tracks whether something called `use` during the current batch of work. // Determines whether we should yield to microtasks to unwrap already resolved // promises without suspending. didUsePromise: boolean, // Track first uncaught error within this act thrownErrors: Array<mixed>, // ReactDebugCurrentFrame getCurrentStack: null | (() => string), // ReactOwnerStackReset recentlyCreatedOwnerStacks: 0, }; export type RendererTask = boolean => RendererTask | null; const ReactSharedInternals: SharedStateClient = ({ H: null, A: null, T: null, S: null, V: null, }: any); if (__DEV__) { ReactSharedInternals.actQueue = null; ReactSharedInternals.isBatchingLegacy = false; ReactSharedInternals.didScheduleLegacyUpdate = false; ReactSharedInternals.didUsePromise = false; ReactSharedInternals.thrownErrors = []; // Stack implementation injected by the current renderer. ReactSharedInternals.getCurrentStack = (null: null | (() => string)); ReactSharedInternals.recentlyCreatedOwnerStacks = 0; } export default ReactSharedInternals;