@@ -204,7 +204,6 @@ import {
204204 ContextOnlyDispatcher ,
205205} from './ReactFiberHooks' ;
206206import { DefaultAsyncDispatcher } from './ReactFiberAsyncDispatcher' ;
207- import { setCurrentOwner } from './ReactFiberCurrentOwner' ;
208207import {
209208 createCapturedValueAtFiber ,
210209 type CapturedValue ,
@@ -230,8 +229,10 @@ import ReactStrictModeWarnings from './ReactStrictModeWarnings';
230229import {
231230 isRendering as ReactCurrentDebugFiberIsRenderingInDEV ,
232231 current as ReactCurrentFiberCurrent ,
233- resetCurrentFiber as resetCurrentDebugFiberInDEV ,
234- setCurrentFiber as setCurrentDebugFiberInDEV ,
232+ setCurrentDebugFiberInDEV ,
233+ resetCurrentDebugFiberInDEV ,
234+ resetCurrentFiber ,
235+ setCurrentFiber ,
235236} from './ReactCurrentFiber' ;
236237import {
237238 isDevToolsPresent ,
@@ -1683,9 +1684,8 @@ function handleThrow(root: FiberRoot, thrownValue: any): void {
16831684 // These should be reset immediately because they're only supposed to be set
16841685 // when React is executing user code.
16851686 resetHooksAfterThrow ( ) ;
1686- resetCurrentDebugFiberInDEV ( ) ;
16871687 if ( __DEV__ || ! disableStringRefs ) {
1688- setCurrentOwner ( null ) ;
1688+ resetCurrentFiber ( ) ;
16891689 }
16901690
16911691 if ( thrownValue === SuspenseException ) {
@@ -2377,18 +2377,16 @@ function performUnitOfWork(unitOfWork: Fiber): void {
23772377 next = beginWork ( current , unitOfWork , entangledRenderLanes ) ;
23782378 }
23792379
2380- resetCurrentDebugFiberInDEV ( ) ;
2380+ if ( __DEV__ || ! disableStringRefs ) {
2381+ resetCurrentFiber ( ) ;
2382+ }
23812383 unitOfWork . memoizedProps = unitOfWork . pendingProps ;
23822384 if ( next === null ) {
23832385 // If this doesn't spawn new work, complete the current work.
23842386 completeUnitOfWork ( unitOfWork ) ;
23852387 } else {
23862388 workInProgress = next ;
23872389 }
2388-
2389- if ( __DEV__ || ! disableStringRefs ) {
2390- setCurrentOwner ( null ) ;
2391- }
23922390}
23932391
23942392function replaySuspendedUnitOfWork ( unitOfWork : Fiber ) : void {
@@ -2399,7 +2397,6 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
23992397 setCurrentDebugFiberInDEV ( unitOfWork ) ;
24002398
24012399 let next ;
2402- setCurrentDebugFiberInDEV ( unitOfWork ) ;
24032400 const isProfilingMode =
24042401 enableProfilerTimer && ( unitOfWork . mode & ProfileMode ) !== NoMode ;
24052402 if ( isProfilingMode ) {
@@ -2492,18 +2489,16 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
24922489 // The begin phase finished successfully without suspending. Return to the
24932490 // normal work loop.
24942491
2495- resetCurrentDebugFiberInDEV ( ) ;
2492+ if ( __DEV__ || ! disableStringRefs ) {
2493+ resetCurrentFiber ( ) ;
2494+ }
24962495 unitOfWork . memoizedProps = unitOfWork . pendingProps ;
24972496 if ( next === null ) {
24982497 // If this doesn't spawn new work, complete the current work.
24992498 completeUnitOfWork ( unitOfWork ) ;
25002499 } else {
25012500 workInProgress = next ;
25022501 }
2503-
2504- if ( __DEV__ || ! disableStringRefs ) {
2505- setCurrentOwner ( null ) ;
2506- }
25072502}
25082503
25092504function throwAndUnwindWorkLoop (
@@ -2893,11 +2888,6 @@ function commitRootImpl(
28932888 const prevExecutionContext = executionContext ;
28942889 executionContext |= CommitContext ;
28952890
2896- // Reset this to null before calling lifecycles
2897- if ( __DEV__ || ! disableStringRefs ) {
2898- setCurrentOwner ( null ) ;
2899- }
2900-
29012891 // The commit phase is broken into several sub-phases. We do a separate pass
29022892 // of the effect list for each phase: all mutation effects come before all
29032893 // layout effects, and so on.
0 commit comments