@@ -204,7 +204,6 @@ import {
204
204
ContextOnlyDispatcher ,
205
205
} from './ReactFiberHooks' ;
206
206
import { DefaultAsyncDispatcher } from './ReactFiberAsyncDispatcher' ;
207
- import { setCurrentOwner } from './ReactFiberCurrentOwner' ;
208
207
import {
209
208
createCapturedValueAtFiber ,
210
209
type CapturedValue ,
@@ -230,8 +229,9 @@ import ReactStrictModeWarnings from './ReactStrictModeWarnings';
230
229
import {
231
230
isRendering as ReactCurrentDebugFiberIsRenderingInDEV ,
232
231
current as ReactCurrentFiberCurrent ,
233
- resetCurrentFiber as resetCurrentDebugFiberInDEV ,
234
- setCurrentFiber as setCurrentDebugFiberInDEV ,
232
+ resetCurrentDebugFiberInDEV ,
233
+ setCurrentDebugFiberInDEV ,
234
+ resetCurrentFiber ,
235
235
} from './ReactCurrentFiber' ;
236
236
import {
237
237
isDevToolsPresent ,
@@ -1683,9 +1683,8 @@ function handleThrow(root: FiberRoot, thrownValue: any): void {
1683
1683
// These should be reset immediately because they're only supposed to be set
1684
1684
// when React is executing user code.
1685
1685
resetHooksAfterThrow ( ) ;
1686
- resetCurrentDebugFiberInDEV ( ) ;
1687
1686
if ( __DEV__ || ! disableStringRefs ) {
1688
- setCurrentOwner ( null ) ;
1687
+ resetCurrentFiber ( ) ;
1689
1688
}
1690
1689
1691
1690
if ( thrownValue === SuspenseException ) {
@@ -2377,18 +2376,16 @@ function performUnitOfWork(unitOfWork: Fiber): void {
2377
2376
next = beginWork ( current , unitOfWork , entangledRenderLanes ) ;
2378
2377
}
2379
2378
2380
- resetCurrentDebugFiberInDEV ( ) ;
2379
+ if ( __DEV__ || ! disableStringRefs ) {
2380
+ resetCurrentFiber ( ) ;
2381
+ }
2381
2382
unitOfWork . memoizedProps = unitOfWork . pendingProps ;
2382
2383
if ( next === null ) {
2383
2384
// If this doesn't spawn new work, complete the current work.
2384
2385
completeUnitOfWork ( unitOfWork ) ;
2385
2386
} else {
2386
2387
workInProgress = next ;
2387
2388
}
2388
-
2389
- if ( __DEV__ || ! disableStringRefs ) {
2390
- setCurrentOwner ( null ) ;
2391
- }
2392
2389
}
2393
2390
2394
2391
function replaySuspendedUnitOfWork ( unitOfWork : Fiber ) : void {
@@ -2399,7 +2396,6 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
2399
2396
setCurrentDebugFiberInDEV ( unitOfWork ) ;
2400
2397
2401
2398
let next ;
2402
- setCurrentDebugFiberInDEV ( unitOfWork ) ;
2403
2399
const isProfilingMode =
2404
2400
enableProfilerTimer && ( unitOfWork . mode & ProfileMode ) !== NoMode ;
2405
2401
if ( isProfilingMode ) {
@@ -2492,18 +2488,16 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
2492
2488
// The begin phase finished successfully without suspending. Return to the
2493
2489
// normal work loop.
2494
2490
2495
- resetCurrentDebugFiberInDEV ( ) ;
2491
+ if ( __DEV__ || ! disableStringRefs ) {
2492
+ resetCurrentFiber ( ) ;
2493
+ }
2496
2494
unitOfWork . memoizedProps = unitOfWork . pendingProps ;
2497
2495
if ( next === null ) {
2498
2496
// If this doesn't spawn new work, complete the current work.
2499
2497
completeUnitOfWork ( unitOfWork ) ;
2500
2498
} else {
2501
2499
workInProgress = next ;
2502
2500
}
2503
-
2504
- if ( __DEV__ || ! disableStringRefs ) {
2505
- setCurrentOwner ( null ) ;
2506
- }
2507
2501
}
2508
2502
2509
2503
function throwAndUnwindWorkLoop (
@@ -2893,11 +2887,6 @@ function commitRootImpl(
2893
2887
const prevExecutionContext = executionContext ;
2894
2888
executionContext |= CommitContext ;
2895
2889
2896
- // Reset this to null before calling lifecycles
2897
- if ( __DEV__ || ! disableStringRefs ) {
2898
- setCurrentOwner ( null ) ;
2899
- }
2900
-
2901
2890
// The commit phase is broken into several sub-phases. We do a separate pass
2902
2891
// of the effect list for each phase: all mutation effects come before all
2903
2892
// layout effects, and so on.
0 commit comments