Resolve cycle

This commit is contained in:
Sebastian Markbage
2024-04-22 12:05:55 -04:00
committed by Rick Hanlon
parent 1af924d03c
commit 88e47069c1
7 changed files with 24 additions and 14 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
import getComponentNameFromType from 'shared/getComponentNameFromType';
import {has as hasInstance} from 'shared/ReactInstanceMap';
import {currentOwner} from 'react-reconciler/src/ReactFiberAsyncDispatcher';
import {currentOwner} from 'react-reconciler/src/ReactFiberCurrentOwner';
import assign from 'shared/assign';
@@ -25,7 +25,7 @@ import {
} from 'react-reconciler/src/ReactFiberReconciler';
import {doesFiberContain} from 'react-reconciler/src/ReactFiberTreeReflection';
import getComponentNameFromType from 'shared/getComponentNameFromType';
import {currentOwner} from 'react-reconciler/src/ReactFiberAsyncDispatcher';
import {currentOwner} from 'react-reconciler/src/ReactFiberCurrentOwner';
export function findHostInstance_DEPRECATED<TElementType: ElementType>(
componentOrHandle: ?(ElementRef<TElementType> | number),
+2 -6
View File
@@ -16,6 +16,8 @@ import {CacheContext} from './ReactFiberCacheComponent';
import {disableStringRefs} from 'shared/ReactFeatureFlags';
import {currentOwner} from './ReactFiberCurrentOwner';
function getCacheForType<T>(resourceType: () => T): T {
if (!enableCache) {
throw new Error('Not implemented.');
@@ -29,8 +31,6 @@ function getCacheForType<T>(resourceType: () => T): T {
return cacheForType;
}
export let currentOwner: Fiber | null = null;
export const DefaultAsyncDispatcher: AsyncDispatcher = ({
getCacheForType,
}: any);
@@ -40,7 +40,3 @@ if (__DEV__ || !disableStringRefs) {
return currentOwner;
};
}
export function setCurrentOwner(fiber: null | Fiber) {
currentOwner = fiber;
}
+1 -1
View File
@@ -296,7 +296,7 @@ import {
pushRootMarkerInstance,
TransitionTracingMarker,
} from './ReactFiberTracingMarkerComponent';
import {setCurrentOwner} from './ReactFiberAsyncDispatcher';
import {setCurrentOwner} from './ReactFiberCurrentOwner';
// A special exception that's used to unwind the stack when an update flows
// into a dehydrated boundary.
+16
View File
@@ -0,0 +1,16 @@
/**
* 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 {Fiber} from './ReactInternalTypes';
export let currentOwner: Fiber | null = null;
export function setCurrentOwner(fiber: null | Fiber) {
currentOwner = fiber;
}
+1 -1
View File
@@ -24,7 +24,7 @@ import {
SuspenseComponent,
} from './ReactWorkTags';
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
import {currentOwner} from './ReactFiberAsyncDispatcher';
import {currentOwner} from './ReactFiberCurrentOwner';
export function getNearestMountedFiber(fiber: Fiber): null | Fiber {
let node = fiber;
+2 -4
View File
@@ -203,10 +203,8 @@ import {
resetHooksOnUnwind,
ContextOnlyDispatcher,
} from './ReactFiberHooks';
import {
DefaultAsyncDispatcher,
setCurrentOwner,
} from './ReactFiberAsyncDispatcher';
import {DefaultAsyncDispatcher} from './ReactFiberAsyncDispatcher';
import {setCurrentOwner} from './ReactFiberCurrentOwner';
import {
createCapturedValueAtFiber,
type CapturedValue,