@@ -17,12 +17,6 @@ import type {
17
17
import ReactSharedInternals from 'shared/ReactSharedInternals' ;
18
18
const { ReactCurrentActQueue} = ReactSharedInternals ;
19
19
20
- import {
21
- getWorkInProgressRoot ,
22
- getWorkInProgressRootRenderLanes ,
23
- attachPingListener ,
24
- } from './ReactFiberWorkLoop' ;
25
-
26
20
export opaque type ThenableState = Array < Thenable < any >> ;
27
21
28
22
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
@@ -94,6 +88,9 @@ export function trackUsedThenable<T>(
94
88
// Only instrument the thenable if the status if not defined. If
95
89
// it's defined, but an unknown value, assume it's been instrumented by
96
90
// some custom userspace implementation. We treat it as "pending".
91
+ // Attach a dummy listener, to ensure that any lazy initialization can
92
+ // happen. Flight lazily parses JSON when the value is actually awaited.
93
+ thenable . then ( noop , noop ) ;
97
94
} else {
98
95
const pendingThenable : PendingThenable < T > = (thenable: any);
99
96
pendingThenable.status = 'pending';
@@ -115,12 +112,6 @@ export function trackUsedThenable<T>(
115
112
) ;
116
113
}
117
114
118
- // Attach ping listeners eagerly in case this synchronously resolves.
119
- const root = getWorkInProgressRoot ( ) ;
120
- if ( root ) {
121
- attachPingListener ( root , thenable , getWorkInProgressRootRenderLanes ( ) ) ;
122
- }
123
-
124
115
// Check one more time in case the thenable resolved synchronously.
125
116
switch ( thenable . status ) {
126
117
case 'fulfilled' : {
0 commit comments