@@ -339,12 +339,10 @@ describe('ReactSuspense', () => {
339
339
async ( ) => {
340
340
const root = ReactDOMClient . createRoot ( container ) ;
341
341
342
- async function interrupt ( ) {
342
+ function interrupt ( ) {
343
343
// React has a heuristic to batch all updates that occur within the same
344
344
// event. This is a trick to circumvent that heuristic.
345
- await act ( ( ) => {
346
- root . render ( 'whatever' ) ;
347
- } ) ;
345
+ ReactDOM . render ( 'whatever' , document . createElement ( 'div' ) ) ;
348
346
}
349
347
350
348
function App ( { shouldSuspend, step} ) {
@@ -360,32 +358,24 @@ describe('ReactSuspense', () => {
360
358
) ;
361
359
}
362
360
363
- await act ( ( ) => {
364
- root . render ( null ) ;
365
- } ) ;
366
-
367
361
root . render ( < App shouldSuspend = { false } step = { 0 } /> ) ;
368
362
await waitForAll ( [ 'A0' , 'B0' , 'C0' ] ) ;
369
363
expect ( container . textContent ) . toEqual ( 'A0B0C0' ) ;
370
364
371
365
// This update will suspend.
372
- await act ( ( ) => {
373
- root . render ( < App shouldSuspend = { true } step = { 1 } /> ) ;
374
- } ) ;
366
+ root . render ( < App shouldSuspend = { true } step = { 1 } /> ) ;
375
367
376
368
// Do a bit of work
377
369
await waitFor ( [ 'A1' ] ) ;
378
370
379
371
// Schedule another update. This will have lower priority because it's
380
372
// a transition.
381
- React . startTransition ( async ( ) => {
382
- await act ( ( ) => {
383
- root . render ( < App shouldSuspend = { false } step = { 2 } /> ) ;
384
- } ) ;
373
+ React . startTransition ( ( ) => {
374
+ root . render ( < App shouldSuspend = { false } step = { 2 } /> ) ;
385
375
} ) ;
386
376
387
377
// Interrupt to trigger a restart.
388
- await interrupt ( ) ;
378
+ interrupt ( ) ;
389
379
390
380
await waitFor ( [
391
381
// Should have restarted the first update, because of the interruption
0 commit comments