File tree Expand file tree Collapse file tree 2 files changed +3
-42
lines changed Expand file tree Collapse file tree 2 files changed +3
-42
lines changed Original file line number Diff line number Diff line change @@ -5426,33 +5426,6 @@ describe('ReactDOMFizzServer', () => {
5426
5426
expect ( Scheduler ) . toFlushAndYield ( [ ] ) ;
5427
5427
expect ( getVisibleChildren ( container ) ) . toEqual ( 'Hi' ) ;
5428
5428
} ) ;
5429
-
5430
- // @gate enableUseHook
5431
- it ( 'unwraps thenable that fulfills synchronously without suspending' , async ( ) => {
5432
- function App ( ) {
5433
- const thenable = {
5434
- then ( resolve ) {
5435
- // This thenable immediately resolves, synchronously, without waiting
5436
- // a microtask.
5437
- resolve ( 'Hi' ) ;
5438
- } ,
5439
- } ;
5440
- try {
5441
- return < Text text = { use ( thenable ) } /> ;
5442
- } catch {
5443
- throw new Error (
5444
- '`use` should not suspend because the thenable resolved synchronously.' ,
5445
- ) ;
5446
- }
5447
- }
5448
- // Because the thenable resolves synchronously, we should be able to finish
5449
- // rendering synchronously, with no fallback.
5450
- await act ( async ( ) => {
5451
- const { pipe} = renderToPipeableStream ( < App /> ) ;
5452
- pipe ( writable ) ;
5453
- } ) ;
5454
- expect ( getVisibleChildren ( container ) ) . toEqual ( 'Hi' ) ;
5455
- } ) ;
5456
5429
} ) ;
5457
5430
5458
5431
describe ( 'useEvent' , ( ) => {
Original file line number Diff line number Diff line change @@ -83,36 +83,24 @@ export function trackUsedThenable<T>(
83
83
// it's defined, but an unknown value, assume it's been instrumented by
84
84
// some custom userspace implementation. We treat it as "pending".
85
85
} else {
86
- const pendingThenable : PendingThenable < T > = (thenable: any);
86
+ const pendingThenable : PendingThenable < mixed > = (thenable: any);
87
87
pendingThenable.status = 'pending';
88
88
pendingThenable.then(
89
89
fulfilledValue => {
90
90
if ( thenable . status === 'pending' ) {
91
- const fulfilledThenable : FulfilledThenable < T > = ( thenable : any ) ;
91
+ const fulfilledThenable : FulfilledThenable < mixed > = ( thenable : any ) ;
92
92
fulfilledThenable . status = 'fulfilled' ;
93
93
fulfilledThenable . value = fulfilledValue ;
94
94
}
95
95
} ,
96
96
( error : mixed ) => {
97
97
if ( thenable . status === 'pending' ) {
98
- const rejectedThenable : RejectedThenable < T > = ( thenable : any ) ;
98
+ const rejectedThenable : RejectedThenable < mixed > = ( thenable : any ) ;
99
99
rejectedThenable . status = 'rejected' ;
100
100
rejectedThenable . reason = error ;
101
101
}
102
102
} ,
103
103
) ;
104
-
105
- // Check one more time in case the thenable resolved synchronously
106
- switch ( thenable . status ) {
107
- case 'fulfilled' : {
108
- const fulfilledThenable : FulfilledThenable < T > = ( thenable : any ) ;
109
- return fulfilledThenable . value ;
110
- }
111
- case 'rejected' : {
112
- const rejectedThenable : RejectedThenable < T > = ( thenable : any ) ;
113
- throw rejectedThenable . reason ;
114
- }
115
- }
116
104
}
117
105
118
106
// Suspend.
You can’t perform that action at this time.
0 commit comments