/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
eslint-plugin-react-hooks@5.0.0
packages/react-server/src/ReactFizzAsyncDispatcher.js
36 строк
958 B
Sebastian Markbåge
[Fizz] Enable owner stacks for SSR (#30152)
01 июл 2024, 17:27
Не верифицирован
01 июл 2024, 17:27
315109b
Код
Авторство
О чём код?
/** * 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 {AsyncDispatcher} from 'react-reconciler/src/ReactInternalTypes'; import type {ComponentStackNode} from './ReactFizzComponentStack'; import {disableStringRefs} from 'shared/ReactFeatureFlags'; import {currentTaskInDEV} from './ReactFizzCurrentTask'; function getCacheForType<T>(resourceType: () => T): T { throw new Error('Not implemented.'); } export const DefaultAsyncDispatcher: AsyncDispatcher = ({ getCacheForType, }: any); if (__DEV__) { DefaultAsyncDispatcher.getOwner = (): ComponentStackNode | null => { if (currentTaskInDEV === null) { return null; } return currentTaskInDEV.componentStack; }; } else if (!disableStringRefs) { DefaultAsyncDispatcher.getOwner = (): null => { return null; }; }