@@ -203,7 +203,8 @@ import {
203203 resetHooksOnUnwind ,
204204 ContextOnlyDispatcher ,
205205} from './ReactFiberHooks' ;
206- import { DefaultCacheDispatcher } from './ReactFiberCache' ;
206+ import { DefaultAsyncDispatcher } from './ReactFiberAsyncDispatcher' ;
207+ import { setCurrentOwner } from './ReactFiberCurrentOwner' ;
207208import {
208209 createCapturedValueAtFiber ,
209210 type CapturedValue ,
@@ -1684,7 +1685,7 @@ function handleThrow(root: FiberRoot, thrownValue: any): void {
16841685 resetHooksAfterThrow ( ) ;
16851686 resetCurrentDebugFiberInDEV ( ) ;
16861687 if ( __DEV__ || ! disableStringRefs ) {
1687- ReactSharedInternals . owner = null ;
1688+ setCurrentOwner ( null ) ;
16881689 }
16891690
16901691 if ( thrownValue === SuspenseException ) {
@@ -1874,19 +1875,19 @@ function popDispatcher(prevDispatcher: any) {
18741875 ReactSharedInternals . H = prevDispatcher ;
18751876}
18761877
1877- function pushCacheDispatcher ( ) {
1878- if ( enableCache ) {
1879- const prevCacheDispatcher = ReactSharedInternals . C ;
1880- ReactSharedInternals . C = DefaultCacheDispatcher ;
1881- return prevCacheDispatcher ;
1878+ function pushAsyncDispatcher ( ) {
1879+ if ( enableCache || __DEV__ || ! disableStringRefs ) {
1880+ const prevAsyncDispatcher = ReactSharedInternals . A ;
1881+ ReactSharedInternals . A = DefaultAsyncDispatcher ;
1882+ return prevAsyncDispatcher ;
18821883 } else {
18831884 return null ;
18841885 }
18851886}
18861887
1887- function popCacheDispatcher ( prevCacheDispatcher : any ) {
1888- if ( enableCache ) {
1889- ReactSharedInternals . C = prevCacheDispatcher ;
1888+ function popAsyncDispatcher ( prevAsyncDispatcher : any ) {
1889+ if ( enableCache || __DEV__ || ! disableStringRefs ) {
1890+ ReactSharedInternals . A = prevAsyncDispatcher ;
18901891 }
18911892}
18921893
@@ -1963,7 +1964,7 @@ function renderRootSync(root: FiberRoot, lanes: Lanes) {
19631964 const prevExecutionContext = executionContext ;
19641965 executionContext |= RenderContext ;
19651966 const prevDispatcher = pushDispatcher ( root . containerInfo ) ;
1966- const prevCacheDispatcher = pushCacheDispatcher ( ) ;
1967+ const prevAsyncDispatcher = pushAsyncDispatcher ( ) ;
19671968
19681969 // If the root or lanes have changed, throw out the existing stack
19691970 // and prepare a fresh one. Otherwise we'll continue where we left off.
@@ -2061,7 +2062,7 @@ function renderRootSync(root: FiberRoot, lanes: Lanes) {
20612062
20622063 executionContext = prevExecutionContext ;
20632064 popDispatcher ( prevDispatcher ) ;
2064- popCacheDispatcher ( prevCacheDispatcher ) ;
2065+ popAsyncDispatcher ( prevAsyncDispatcher ) ;
20652066
20662067 if ( workInProgress !== null ) {
20672068 // This is a sync render, so we should have finished the whole tree.
@@ -2104,7 +2105,7 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
21042105 const prevExecutionContext = executionContext ;
21052106 executionContext |= RenderContext ;
21062107 const prevDispatcher = pushDispatcher ( root . containerInfo ) ;
2107- const prevCacheDispatcher = pushCacheDispatcher ( ) ;
2108+ const prevAsyncDispatcher = pushAsyncDispatcher ( ) ;
21082109
21092110 // If the root or lanes have changed, throw out the existing stack
21102111 // and prepare a fresh one. Otherwise we'll continue where we left off.
@@ -2317,7 +2318,7 @@ function renderRootConcurrent(root: FiberRoot, lanes: Lanes) {
23172318 resetContextDependencies ( ) ;
23182319
23192320 popDispatcher ( prevDispatcher ) ;
2320- popCacheDispatcher ( prevCacheDispatcher ) ;
2321+ popAsyncDispatcher ( prevAsyncDispatcher ) ;
23212322 executionContext = prevExecutionContext ;
23222323
23232324 if ( __DEV__ ) {
@@ -2386,7 +2387,7 @@ function performUnitOfWork(unitOfWork: Fiber): void {
23862387 }
23872388
23882389 if ( __DEV__ || ! disableStringRefs ) {
2389- ReactSharedInternals . owner = null ;
2390+ setCurrentOwner ( null ) ;
23902391 }
23912392}
23922393
@@ -2501,7 +2502,7 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
25012502 }
25022503
25032504 if ( __DEV__ || ! disableStringRefs ) {
2504- ReactSharedInternals . owner = null ;
2505+ setCurrentOwner ( null ) ;
25052506 }
25062507}
25072508
@@ -2894,7 +2895,7 @@ function commitRootImpl(
28942895
28952896 // Reset this to null before calling lifecycles
28962897 if ( __DEV__ || ! disableStringRefs ) {
2897- ReactSharedInternals . owner = null ;
2898+ setCurrentOwner ( null ) ;
28982899 }
28992900
29002901 // The commit phase is broken into several sub-phases. We do a separate pass
0 commit comments