@@ -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,9 @@ import ReactStrictModeWarnings from './ReactStrictModeWarnings';
230229import {
231230 isRendering as ReactCurrentDebugFiberIsRenderingInDEV ,
232231 current as ReactCurrentFiberCurrent ,
233- resetCurrentFiber as resetCurrentDebugFiberInDEV ,
234- setCurrentFiber as setCurrentDebugFiberInDEV ,
232+ resetCurrentDebugFiberInDEV ,
233+ setCurrentDebugFiberInDEV ,
234+ resetCurrentFiber ,
235235} from './ReactCurrentFiber' ;
236236import {
237237 isDevToolsPresent ,
@@ -1683,9 +1683,8 @@ function handleThrow(root: FiberRoot, thrownValue: any): void {
16831683 // These should be reset immediately because they're only supposed to be set
16841684 // when React is executing user code.
16851685 resetHooksAfterThrow ( ) ;
1686- resetCurrentDebugFiberInDEV ( ) ;
16871686 if ( __DEV__ || ! disableStringRefs ) {
1688- setCurrentOwner ( null ) ;
1687+ resetCurrentFiber ( ) ;
16891688 }
16901689
16911690 if ( thrownValue === SuspenseException ) {
@@ -2377,18 +2376,16 @@ function performUnitOfWork(unitOfWork: Fiber): void {
23772376 next = beginWork ( current , unitOfWork , entangledRenderLanes ) ;
23782377 }
23792378
2380- resetCurrentDebugFiberInDEV ( ) ;
2379+ if ( __DEV__ || ! disableStringRefs ) {
2380+ resetCurrentFiber ( ) ;
2381+ }
23812382 unitOfWork . memoizedProps = unitOfWork . pendingProps ;
23822383 if ( next === null ) {
23832384 // If this doesn't spawn new work, complete the current work.
23842385 completeUnitOfWork ( unitOfWork ) ;
23852386 } else {
23862387 workInProgress = next ;
23872388 }
2388-
2389- if ( __DEV__ || ! disableStringRefs ) {
2390- setCurrentOwner ( null ) ;
2391- }
23922389}
23932390
23942391function replaySuspendedUnitOfWork ( unitOfWork : Fiber ) : void {
@@ -2399,7 +2396,6 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
23992396 setCurrentDebugFiberInDEV ( unitOfWork ) ;
24002397
24012398 let next ;
2402- setCurrentDebugFiberInDEV ( unitOfWork ) ;
24032399 const isProfilingMode =
24042400 enableProfilerTimer && ( unitOfWork . mode & ProfileMode ) !== NoMode ;
24052401 if ( isProfilingMode ) {
@@ -2492,18 +2488,16 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
24922488 // The begin phase finished successfully without suspending. Return to the
24932489 // normal work loop.
24942490
2495- resetCurrentDebugFiberInDEV ( ) ;
2491+ if ( __DEV__ || ! disableStringRefs ) {
2492+ resetCurrentFiber ( ) ;
2493+ }
24962494 unitOfWork . memoizedProps = unitOfWork . pendingProps ;
24972495 if ( next === null ) {
24982496 // If this doesn't spawn new work, complete the current work.
24992497 completeUnitOfWork ( unitOfWork ) ;
25002498 } else {
25012499 workInProgress = next ;
25022500 }
2503-
2504- if ( __DEV__ || ! disableStringRefs ) {
2505- setCurrentOwner ( null ) ;
2506- }
25072501}
25082502
25092503function throwAndUnwindWorkLoop (
@@ -2893,11 +2887,6 @@ function commitRootImpl(
28932887 const prevExecutionContext = executionContext ;
28942888 executionContext |= CommitContext ;
28952889
2896- // Reset this to null before calling lifecycles
2897- if ( __DEV__ || ! disableStringRefs ) {
2898- setCurrentOwner ( null ) ;
2899- }
2900-
29012890 // The commit phase is broken into several sub-phases. We do a separate pass
29022891 // of the effect list for each phase: all mutation effects come before all
29032892 // layout effects, and so on.
0 commit comments