Prerender during same pass if blocked anyway (#30879)
If something suspends in the shell — i.e. we won't replace the suspended content with a fallback — we might as well prerender the siblings during the current render pass, instead of spawning a separate prerender pass. This is implemented by setting the "is prerendering" flag to true whenever we suspend in the shell. But only if we haven't already skipped over some siblings, because if so, then we need to schedule a separate prerender pass regardless.
Andrew Clark committed
Sep 10, 2024 at 13:23 UTC
66cf2cfc8a8c4b09d2b783fd7302ae6b24150935
20 files changed
+96
-521
packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js
+4
@@ -238,12 +238,14 @@ describe('ReactCache', () => {
238
await act(() => jest.advanceTimersByTime(100));
239
assertLog([
240
'Promise resolved [4]',
241
+
242
1,
243
4,
244
'Suspend! [5]',
245
1,
246
4,
247
'Suspend! [5]',
248
+
249
'Promise resolved [5]',
250
1,
251
4,
@@ -274,12 +276,14 @@ describe('ReactCache', () => {
276
await act(() => jest.advanceTimersByTime(100));
277
assertLog([
278
'Promise resolved [2]',
279
+
280
1,
281
2,
282
'Suspend! [3]',
283
1,
284
2,
285
'Suspend! [3]',
286
+
287
'Promise resolved [3]',
288
1,
289
2,
packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js
+1
-1
@@ -744,7 +744,7 @@ describe('ReactDOMFiberAsync', () => {
744
// Because it suspended, it remains on the current path
745
expect(div.textContent).toBe('/path/a');
746
});
747
- assertLog(gate('enableSiblingPrerendering') ? ['Suspend! [/path/b]'] : []);
747
+ assertLog([]);
748
749
await act(async () => {
750
resolvePromise();
packages/react-dom/src/__tests__/ReactDOMForm-test.js
+5
-44
@@ -699,15 +699,7 @@ describe('ReactDOMForm', () => {
699
// This should suspend because form actions are implicitly wrapped
700
// in startTransition.
701
await submit(formRef.current);
702
- assertLog([
703
- 'Pending...',
704
- 'Suspend! [Updated]',
705
- 'Loading...',
706
-
707
- ...(gate('enableSiblingPrerendering')
708
- ? ['Suspend! [Updated]', 'Loading...']
709
- : []),
710
- ]);
702
+ assertLog(['Pending...', 'Suspend! [Updated]', 'Loading...']);
703
expect(container.textContent).toBe('Pending...Initial');
704
705
await act(() => resolveText('Updated'));
@@ -744,15 +736,7 @@ describe('ReactDOMForm', () => {
736
737
// Update
738
await submit(formRef.current);
747
- assertLog([
748
- 'Pending...',
749
- 'Suspend! [Count: 1]',
750
- 'Loading...',
751
-
752
- ...(gate('enableSiblingPrerendering')
753
- ? ['Suspend! [Count: 1]', 'Loading...']
754
- : []),
755
- ]);
739
+ assertLog(['Pending...', 'Suspend! [Count: 1]', 'Loading...']);
740
expect(container.textContent).toBe('Pending...Count: 0');
741
742
await act(() => resolveText('Count: 1'));
@@ -761,15 +745,7 @@ describe('ReactDOMForm', () => {
745
746
// Update again
747
await submit(formRef.current);
764
- assertLog([
765
- 'Pending...',
766
- 'Suspend! [Count: 2]',
767
- 'Loading...',
768
-
769
- ...(gate('enableSiblingPrerendering')
770
- ? ['Suspend! [Count: 2]', 'Loading...']
771
- : []),
772
- ]);
748
+ assertLog(['Pending...', 'Suspend! [Count: 2]', 'Loading...']);
749
expect(container.textContent).toBe('Pending...Count: 1');
750
751
await act(() => resolveText('Count: 2'));
@@ -813,14 +789,7 @@ describe('ReactDOMForm', () => {
789
assertLog(['Async action started', 'Pending...']);
790
791
await act(() => resolveText('Wait'));
816
- assertLog([
817
- 'Suspend! [Updated]',
818
- 'Loading...',
819
-
820
- ...(gate('enableSiblingPrerendering')
821
- ? ['Suspend! [Updated]', 'Loading...']
822
- : []),
823
- ]);
792
+ assertLog(['Suspend! [Updated]', 'Loading...']);
793
expect(container.textContent).toBe('Pending...Initial');
794
795
await act(() => resolveText('Updated'));
@@ -1506,15 +1475,7 @@ describe('ReactDOMForm', () => {
1475
// Now dispatch inside of a transition. This one does not trigger a
1476
// loading state.
1477
await act(() => startTransition(() => dispatch()));
1509
- assertLog([
1510
- 'Count: 1',
1511
- 'Suspend! [Count: 2]',
1512
- 'Loading...',
1513
-
1514
- ...(gate('enableSiblingPrerendering')
1515
- ? ['Suspend! [Count: 2]', 'Loading...']
1516
- : []),
1517
- ]);
1478
+ assertLog(['Count: 1', 'Suspend! [Count: 2]', 'Loading...']);
1479
expect(container.textContent).toBe('Count: 1');
1480
1481
await act(() => resolveText('Count: 2'));
packages/react-reconciler/src/ReactFiberHooks.js
+2
-2
@@ -1690,7 +1690,7 @@ function mountSyncExternalStore<T>(
1690
}
1691
1692
const rootRenderLanes = getWorkInProgressRootRenderLanes();
1693
- if (!includesBlockingLane(root, rootRenderLanes)) {
1693
+ if (!includesBlockingLane(rootRenderLanes)) {
1694
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
1695
}
1696
}
@@ -1802,7 +1802,7 @@ function updateSyncExternalStore<T>(
1802
);
1803
}
1804
1805
- if (!isHydrating && !includesBlockingLane(root, renderLanes)) {
1805
+ if (!isHydrating && !includesBlockingLane(renderLanes)) {
1806
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
1807
}
1808
}
packages/react-reconciler/src/ReactFiberLane.js
+1
-1
@@ -579,7 +579,7 @@ export function includesOnlyTransitions(lanes: Lanes): boolean {
579
return (lanes & TransitionLanes) === lanes;
580
}
581
582
-export function includesBlockingLane(root: FiberRoot, lanes: Lanes): boolean {
582
+export function includesBlockingLane(lanes: Lanes): boolean {
583
const SyncDefaultLanes =
584
InputContinuousHydrationLane |
585
InputContinuousLane |
packages/react-reconciler/src/ReactFiberWorkLoop.js
+13
-1
@@ -907,7 +907,7 @@ export function performConcurrentWorkOnRoot(
907
// bug we're still investigating. Once the bug in Scheduler is fixed,
908
// we can remove this, since we track expiration ourselves.
909
const shouldTimeSlice =
910
- !includesBlockingLane(root, lanes) &&
910
+ !includesBlockingLane(lanes) &&
911
!includesExpiredLane(root, lanes) &&
912
(disableSchedulerTimeoutInWorkLoop || !didTimeout);
913
let exitStatus = shouldTimeSlice
@@ -1968,6 +1968,18 @@ export function renderDidSuspend(): void {
1968
export function renderDidSuspendDelayIfPossible(): void {
1969
workInProgressRootExitStatus = RootSuspendedWithDelay;
1970
1971
+ if (
1972
+ !workInProgressRootDidSkipSuspendedSiblings &&
1973
+ !includesBlockingLane(workInProgressRootRenderLanes)
1974
+ ) {
1975
+ // This render may not have originally been scheduled as a prerender, but
1976
+ // something suspended inside the visible part of the tree, which means we
1977
+ // won't be able to commit a fallback anyway. Let's proceed as if this were
1978
+ // a prerender so that we can warm up the siblings without scheduling a
1979
+ // separate pass.
1980
+ workInProgressRootIsPrerendering = true;
1981
+ }
1982
+
1983
// Check if there are updates that we skipped tree that might have unblocked
1984
// this render.
1985
if (
packages/react-reconciler/src/__tests__/ActivitySuspense-test.js
+2
-18
@@ -215,15 +215,7 @@ describe('Activity Suspense', () => {
215
);
216
});
217
});
218
- assertLog([
219
- 'Open',
220
- 'Suspend! [Async]',
221
- 'Loading...',
222
-
223
- ...(gate('enableSiblingPrerendering')
224
- ? ['Open', 'Suspend! [Async]', 'Loading...']
225
- : []),
226
- ]);
218
+ assertLog(['Open', 'Suspend! [Async]', 'Loading...']);
219
// It should suspend with delay to prevent the already-visible Suspense
220
// boundary from switching to a fallback
221
expect(root).toMatchRenderedOutput(<span>Closed</span>);
@@ -284,15 +276,7 @@ describe('Activity Suspense', () => {
276
);
277
});
278
});
287
- assertLog([
288
- 'Open',
289
- 'Suspend! [Async]',
290
- 'Loading...',
291
-
292
- ...(gate('enableSiblingPrerendering')
293
- ? ['Open', 'Suspend! [Async]', 'Loading...']
294
- : []),
295
- ]);
279
+ assertLog(['Open', 'Suspend! [Async]', 'Loading...']);
280
// It should suspend with delay to prevent the already-visible Suspense
281
// boundary from switching to a fallback
282
expect(root).toMatchRenderedOutput(
packages/react-reconciler/src/__tests__/ReactActWarnings-test.js
+1
-8
@@ -349,14 +349,7 @@ describe('act warnings', () => {
349
root.render(<App showMore={true} />);
350
});
351
});
352
- assertLog([
353
- 'Suspend! [Async]',
354
- 'Loading...',
355
-
356
- ...(gate('enableSiblingPrerendering')
357
- ? ['Suspend! [Async]', 'Loading...']
358
- : []),
359
- ]);
352
+ assertLog(['Suspend! [Async]', 'Loading...']);
353
expect(root).toMatchRenderedOutput('(empty)');
354
355
// This is a ping, not a retry, because no fallback is showing.
packages/react-reconciler/src/__tests__/ReactAsyncActions-test.js
+3
-18
@@ -303,7 +303,7 @@ describe('ReactAsyncActions', () => {
303
'Suspend! [A1]',
304
305
...(gate('enableSiblingPrerendering')
306
- ? ['Pending: false', 'Suspend! [A1]', 'Suspend! [B1]', 'Suspend! [C1]']
306
+ ? ['Suspend! [B1]', 'Suspend! [C1]']
307
: []),
308
]);
309
expect(root).toMatchRenderedOutput(
@@ -322,9 +322,7 @@ describe('ReactAsyncActions', () => {
322
'A1',
323
'Suspend! [B1]',
324
325
- ...(gate('enableSiblingPrerendering')
326
- ? ['Pending: false', 'A1', 'Suspend! [B1]', 'Suspend! [C1]']
327
- : []),
325
+ ...(gate('enableSiblingPrerendering') ? ['Suspend! [C1]'] : []),
326
]);
327
expect(root).toMatchRenderedOutput(
328
<>
@@ -333,16 +331,7 @@ describe('ReactAsyncActions', () => {
331
</>,
332
);
333
await act(() => resolveText('B1'));
336
- assertLog([
337
- 'Pending: false',
338
- 'A1',
339
- 'B1',
340
- 'Suspend! [C1]',
341
-
342
- ...(gate('enableSiblingPrerendering')
343
- ? ['Pending: false', 'A1', 'B1', 'Suspend! [C1]']
344
- : []),
345
- ]);
334
+ assertLog(['Pending: false', 'A1', 'B1', 'Suspend! [C1]']);
335
expect(root).toMatchRenderedOutput(
336
<>
337
<span>Pending: true</span>
@@ -715,10 +704,6 @@ describe('ReactAsyncActions', () => {
704
// automatically reverted.
705
'Pending: false',
706
'Suspend! [B]',
718
-
719
- ...(gate('enableSiblingPrerendering')
720
- ? ['Pending: false', 'Suspend! [B]']
721
- : []),
707
]);
708
709
// Resolve the transition
packages/react-reconciler/src/__tests__/ReactConcurrentErrorRecovery-test.js
+7
-42
@@ -209,16 +209,7 @@ describe('ReactConcurrentErrorRecovery', () => {
209
root.render(<App step={2} />);
210
});
211
});
212
- assertLog([
213
- 'Suspend! [A2]',
214
- 'Loading...',
215
- 'Suspend! [B2]',
216
- 'Loading...',
217
-
218
- ...(gate('enableSiblingPrerendering')
219
- ? ['Suspend! [A2]', 'Loading...', 'Suspend! [B2]', 'Loading...']
220
- : []),
221
- ]);
212
+ assertLog(['Suspend! [A2]', 'Loading...', 'Suspend! [B2]', 'Loading...']);
213
// Because this is a refresh, we don't switch to a fallback
214
expect(root).toMatchRenderedOutput('A1B1');
215
@@ -229,16 +220,7 @@ describe('ReactConcurrentErrorRecovery', () => {
220
221
// Because we're still suspended on A, we can't show an error boundary. We
222
// should wait for A to resolve.
232
- assertLog([
233
- 'Suspend! [A2]',
234
- 'Loading...',
235
- 'Error! [B2]',
236
- 'Oops!',
237
-
238
- ...(gate('enableSiblingPrerendering')
239
- ? ['Suspend! [A2]', 'Loading...', 'Error! [B2]', 'Oops!']
240
- : []),
241
- ]);
223
+ assertLog(['Suspend! [A2]', 'Loading...', 'Error! [B2]', 'Oops!']);
224
// Remain on previous screen.
225
expect(root).toMatchRenderedOutput('A1B1');
226
@@ -299,16 +281,7 @@ describe('ReactConcurrentErrorRecovery', () => {
281
root.render(<App step={2} />);
282
});
283
});
302
- assertLog([
303
- 'Suspend! [A2]',
304
- 'Loading...',
305
- 'Suspend! [B2]',
306
- 'Loading...',
307
-
308
- ...(gate('enableSiblingPrerendering')
309
- ? ['Suspend! [A2]', 'Loading...', 'Suspend! [B2]', 'Loading...']
310
- : []),
311
- ]);
284
+ assertLog(['Suspend! [A2]', 'Loading...', 'Suspend! [B2]', 'Loading...']);
285
// Because this is a refresh, we don't switch to a fallback
286
expect(root).toMatchRenderedOutput('A1B1');
287
@@ -364,11 +337,7 @@ describe('ReactConcurrentErrorRecovery', () => {
337
root.render(<AsyncText text="Async" />);
338
});
339
});
367
- assertLog([
368
- 'Suspend! [Async]',
369
-
370
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Async]'] : []),
371
- ]);
340
+ assertLog(['Suspend! [Async]']);
341
expect(root).toMatchRenderedOutput(null);
342
343
// This also works if the suspended component is wrapped with an error
@@ -384,11 +353,7 @@ describe('ReactConcurrentErrorRecovery', () => {
353
);
354
});
355
});
387
- assertLog([
388
- 'Suspend! [Async]',
389
-
390
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Async]'] : []),
391
- ]);
356
+ assertLog(['Suspend! [Async]']);
357
expect(root).toMatchRenderedOutput(null);
358
359
// Continues rendering once data resolves
@@ -445,7 +410,7 @@ describe('ReactConcurrentErrorRecovery', () => {
410
'Suspend! [Async]',
411
412
...(gate('enableSiblingPrerendering')
448
- ? ['Suspend! [Async]', 'Caught an error: Oops!']
413
+ ? ['Caught an error: Oops!']
414
: []),
415
]);
416
// The render suspended without committing the error.
@@ -468,7 +433,7 @@ describe('ReactConcurrentErrorRecovery', () => {
433
'Suspend! [Async]',
434
435
...(gate('enableSiblingPrerendering')
471
- ? ['Suspend! [Async]', 'Caught an error: Oops!']
436
+ ? ['Caught an error: Oops!']
437
: []),
438
]);
439
expect(root).toMatchRenderedOutput(null);
packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js
-10
@@ -420,8 +420,6 @@ describe('ReactDeferredValue', () => {
420
// The initial value suspended, so we attempt the final value, which
421
// also suspends.
422
'Suspend! [Final]',
423
-
424
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Final]'] : []),
423
]);
424
expect(root).toMatchRenderedOutput(null);
425
@@ -461,8 +459,6 @@ describe('ReactDeferredValue', () => {
459
// The initial value suspended, so we attempt the final value, which
460
// also suspends.
461
'Suspend! [Final]',
464
-
465
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Final]'] : []),
462
]);
463
expect(root).toMatchRenderedOutput(null);
464
@@ -535,8 +531,6 @@ describe('ReactDeferredValue', () => {
531
// The initial value suspended, so we attempt the final value, which
532
// also suspends.
533
'Suspend! [Final]',
538
-
539
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Final]'] : []),
534
]);
535
expect(root).toMatchRenderedOutput(null);
536
@@ -546,8 +540,6 @@ describe('ReactDeferredValue', () => {
540
'Loading...',
541
// Still waiting for the final value.
542
'Suspend! [Final]',
549
-
550
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Final]'] : []),
543
]);
544
expect(root).toMatchRenderedOutput('Loading...');
545
@@ -592,8 +584,6 @@ describe('ReactDeferredValue', () => {
584
// boundaries work, where we always prefer to show the innermost
585
// loading state.)
586
'Suspend! [Content]',
595
-
596
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Content]'] : []),
587
]);
588
// Still showing the App preview state because the inner
589
// content suspended.
packages/react-reconciler/src/__tests__/ReactExpiration-test.js
+3
-4
@@ -654,11 +654,10 @@ describe('ReactExpiration', () => {
654
});
655
await waitForAll([
656
'Suspend! [A1]',
657
- 'Loading...',
657
659
- ...(gate('enableSiblingPrerendering')
660
- ? ['Suspend! [A1]', 'B', 'C', 'Loading...']
661
- : []),
658
+ ...(gate('enableSiblingPrerendering') ? ['B', 'C'] : []),
659
+
660
+ 'Loading...',
661
]);
662
663
// Lots of time elapses before the promise resolves
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
+5
-38
@@ -652,22 +652,14 @@ describe('ReactHooksWithNoopRenderer', () => {
652
React.startTransition(() => {
653
root.render(<Foo signal={false} />);
654
});
655
- await waitForAll([
656
- 'Suspend!',
657
-
658
- ...(gate('enableSiblingPrerendering') ? ['Suspend!'] : []),
659
- ]);
655
+ await waitForAll(['Suspend!']);
656
expect(root).toMatchRenderedOutput(<span prop={0} />);
657
658
// Rendering again should suspend again.
659
React.startTransition(() => {
660
root.render(<Foo signal={false} />);
661
});
666
- await waitForAll([
667
- 'Suspend!',
668
-
669
- ...(gate('enableSiblingPrerendering') ? ['Suspend!'] : []),
670
- ]);
662
+ await waitForAll(['Suspend!']);
663
});
664
665
it('discards render phase updates if something suspends, but not other updates in the same component', async () => {
@@ -717,22 +709,14 @@ describe('ReactHooksWithNoopRenderer', () => {
709
setLabel('B');
710
});
711
720
- await waitForAll([
721
- 'Suspend!',
722
-
723
- ...(gate('enableSiblingPrerendering') ? ['Suspend!'] : []),
724
- ]);
712
+ await waitForAll(['Suspend!']);
713
expect(root).toMatchRenderedOutput(<span prop="A:0" />);
714
715
// Rendering again should suspend again.
716
React.startTransition(() => {
717
root.render(<Foo signal={false} />);
718
});
731
- await waitForAll([
732
- 'Suspend!',
733
-
734
- ...(gate('enableSiblingPrerendering') ? ['Suspend!'] : []),
735
- ]);
719
+ await waitForAll(['Suspend!']);
720
721
// Flip the signal back to "cancel" the update. However, the update to
722
// label should still proceed. It shouldn't have been dropped.
@@ -3511,13 +3495,6 @@ describe('ReactHooksWithNoopRenderer', () => {
3495
'Before... Pending: true',
3496
'Suspend! [After... Pending: false]',
3497
'Loading... Pending: false',
3514
-
3515
- ...(gate('enableSiblingPrerendering')
3516
- ? [
3517
- 'Suspend! [After... Pending: false]',
3518
- 'Loading... Pending: false',
3519
- ]
3520
- : []),
3498
]);
3499
expect(ReactNoop).toMatchRenderedOutput(
3500
<span prop="Before... Pending: true" />,
@@ -3586,17 +3563,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3563
3564
await act(async () => {
3565
_setText('B');
3589
- await waitForAll([
3590
- 'B',
3591
- 'A',
3592
- 'B',
3593
- 'Suspend! [B]',
3594
- 'Loading',
3595
-
3596
- ...(gate('enableSiblingPrerendering')
3597
- ? ['B', 'Suspend! [B]', 'Loading']
3598
- : []),
3599
- ]);
3566
+ await waitForAll(['B', 'A', 'B', 'Suspend! [B]', 'Loading']);
3567
await waitForAll([]);
3568
expect(ReactNoop).toMatchRenderedOutput(
3569
<>
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
+2
-12
@@ -1488,20 +1488,10 @@ describe('ReactLazy', () => {
1488
React.startTransition(() => {
1489
root.update(<Parent swap={true} />);
1490
});
1491
- await waitForAll([
1492
- 'Init B2',
1493
- 'Loading...',
1494
-
1495
- ...(gate('enableSiblingPrerendering') ? ['Loading...'] : []),
1496
- ]);
1491
+ await waitForAll(['Init B2', 'Loading...']);
1492
await act(() => resolveFakeImport(ChildB2));
1493
// We need to flush to trigger the second one to load.
1499
- assertLog([
1500
- 'Init A2',
1501
- 'Loading...',
1502
-
1503
- ...(gate('enableSiblingPrerendering') ? ['Loading...'] : []),
1504
- ]);
1494
+ assertLog(['Init A2', 'Loading...']);
1495
await act(() => resolveFakeImport(ChildA2));
1496
assertLog(['b', 'a', 'Did update: b', 'Did update: a']);
1497
expect(root).toMatchRenderedOutput('ba');
packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
+3
-4
@@ -135,11 +135,10 @@ describe('ReactSuspense', () => {
135
'Bar',
136
// A suspends
137
'Suspend! [A]',
138
- 'Loading...',
138
140
- ...(gate('enableSiblingPrerendering')
141
- ? ['Foo', 'Bar', 'Suspend! [A]', 'B', 'Loading...']
142
- : []),
139
+ ...(gate('enableSiblingPrerendering') ? ['B'] : []),
140
+
141
+ 'Loading...',
142
]);
143
expect(container.textContent).toEqual('');
144
packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js
+31
-207
@@ -295,22 +295,12 @@ describe('ReactSuspenseWithNoopRenderer', () => {
295
'Bar',
296
// A suspends
297
'Suspend! [A]',
298
+
299
+ ...(gate('enableSiblingPrerendering') ? ['B'] : []),
300
+
301
// We immediately unwind and switch to a fallback without
302
// rendering siblings.
303
'Loading...',
301
-
302
- ...(gate('enableSiblingPrerendering')
303
- ? [
304
- 'Foo',
305
- 'Bar',
306
- // A suspends
307
- 'Suspend! [A]',
308
- 'B',
309
- // We immediately unwind and switch to a fallback without
310
- // rendering siblings.
311
- 'Loading...',
312
- ]
313
- : []),
304
]);
305
expect(ReactNoop).toMatchRenderedOutput(null);
306
@@ -395,11 +385,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
385
await waitForAll([
386
'A',
387
'Suspend! [B]',
398
- 'Loading...',
388
400
- ...(gate('enableSiblingPrerendering')
401
- ? ['A', 'Suspend! [B]', 'C', 'D', 'Loading...']
402
- : []),
389
+ ...(gate('enableSiblingPrerendering') ? ['C', 'D'] : []),
390
+
391
+ 'Loading...',
392
]);
393
// Did not commit yet.
394
expect(ReactNoop).toMatchRenderedOutput(null);
@@ -457,14 +446,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
446
React.startTransition(() => {
447
ReactNoop.render(<App renderContent={true} />);
448
});
460
- await waitForAll([
461
- 'Suspend! [Result]',
462
- 'Loading...',
463
-
464
- ...(gate('enableSiblingPrerendering')
465
- ? ['Suspend! [Result]', 'Loading...']
466
- : []),
467
- ]);
449
+ await waitForAll(['Suspend! [Result]', 'Loading...']);
450
expect(ReactNoop).toMatchRenderedOutput(null);
451
452
await rejectText('Result', new Error('Failed to load: Result'));
@@ -579,14 +561,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
561
// Update the low-pri text
562
await act(() => startTransition(() => setLowPri('2')));
563
// Suspends
582
- assertLog([
583
- 'Suspend! [2]',
584
- 'Loading...',
585
-
586
- ...(gate('enableSiblingPrerendering')
587
- ? ['Suspend! [2]', 'Loading...']
588
- : []),
589
- ]);
564
+ assertLog(['Suspend! [2]', 'Loading...']);
565
566
// While we're still waiting for the low-pri update to complete, update the
567
// high-pri text at high priority.
@@ -631,14 +606,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
606
React.startTransition(() => {
607
ReactNoop.render(<App showA={true} showB={false} />);
608
});
634
- await waitForAll([
635
- 'Suspend! [A]',
636
- 'Loading...',
637
-
638
- ...(gate('enableSiblingPrerendering')
639
- ? ['Suspend! [A]', 'Loading...']
640
- : []),
641
- ]);
609
+ await waitForAll(['Suspend! [A]', 'Loading...']);
610
expect(ReactNoop).toMatchRenderedOutput(null);
611
612
React.startTransition(() => {
@@ -646,11 +614,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
614
});
615
await waitForAll([
616
'Suspend! [A]',
649
- 'Loading...',
617
651
- ...(gate('enableSiblingPrerendering')
652
- ? ['Suspend! [A]', 'B', 'Loading...']
653
- : []),
618
+ ...(gate('enableSiblingPrerendering') ? ['B'] : []),
619
+
620
+ 'Loading...',
621
]);
622
expect(ReactNoop).toMatchRenderedOutput(null);
623
@@ -989,14 +956,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
956
</Suspense>,
957
);
958
});
992
- await waitForAll([
993
- 'Suspend! [Async]',
994
- 'Loading...',
995
-
996
- ...(gate('enableSiblingPrerendering')
997
- ? ['Suspend! [Async]', 'Loading...']
998
- : []),
999
- ]);
959
+ await waitForAll(['Suspend! [Async]', 'Loading...']);
960
expect(ReactNoop).toMatchRenderedOutput(null);
961
962
// Resolve the promise
@@ -1028,14 +988,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
988
// Schedule an update, and suspend for up to 5 seconds.
989
React.startTransition(() => ReactNoop.render(<App text="A" />));
990
// The update should suspend.
1031
- await waitForAll([
1032
- 'Suspend! [A]',
1033
- 'Loading...',
1034
-
1035
- ...(gate('enableSiblingPrerendering')
1036
- ? ['Suspend! [A]', 'Loading...']
1037
- : []),
1038
- ]);
991
+ await waitForAll(['Suspend! [A]', 'Loading...']);
992
expect(ReactNoop).toMatchRenderedOutput(<span prop="S" />);
993
994
// Advance time until right before it expires.
@@ -1047,14 +1000,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1000
// Schedule another low priority update.
1001
React.startTransition(() => ReactNoop.render(<App text="B" />));
1002
// This update should also suspend.
1050
- await waitForAll([
1051
- 'Suspend! [B]',
1052
- 'Loading...',
1053
-
1054
- ...(gate('enableSiblingPrerendering')
1055
- ? ['Suspend! [B]', 'Loading...']
1056
- : []),
1057
- ]);
1003
+ await waitForAll(['Suspend! [B]', 'Loading...']);
1004
expect(ReactNoop).toMatchRenderedOutput(<span prop="S" />);
1005
1006
// Schedule a regular update. Its expiration time will fall between
@@ -2320,16 +2266,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2266
ReactNoop.render(<Foo showB={true} />);
2267
});
2268
2323
- await waitForAll([
2324
- 'Foo',
2325
- 'A',
2326
- 'Suspend! [B]',
2327
- 'Loading B...',
2328
-
2329
- ...(gate('enableSiblingPrerendering')
2330
- ? ['Foo', 'A', 'Suspend! [B]', 'Loading B...']
2331
- : []),
2332
- ]);
2269
+ await waitForAll(['Foo', 'A', 'Suspend! [B]', 'Loading B...']);
2270
2271
// Transitions never fall back.
2272
expect(ReactNoop).toMatchRenderedOutput(<span prop="A" />);
@@ -2405,14 +2342,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2342
// Start transition.
2343
React.startTransition(() => ReactNoop.render(<App page="B" />));
2344
2408
- await waitForAll([
2409
- 'Suspend! [B]',
2410
- 'Loading...',
2411
-
2412
- ...(gate('enableSiblingPrerendering')
2413
- ? ['Suspend! [B]', 'Loading...']
2414
- : []),
2415
- ]);
2345
+ await waitForAll(['Suspend! [B]', 'Loading...']);
2346
Scheduler.unstable_advanceTime(100000);
2347
await advanceTimers(100000);
2348
// Even after lots of time has passed, we have still not yet flushed the
@@ -2463,14 +2393,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2393
await act(async () => {
2394
React.startTransition(() => transitionToPage('B'));
2395
2466
- await waitForAll([
2467
- 'Suspend! [B]',
2468
- 'Loading...',
2469
-
2470
- ...(gate('enableSiblingPrerendering')
2471
- ? ['Suspend! [B]', 'Loading...']
2472
- : []),
2473
- ]);
2396
+ await waitForAll(['Suspend! [B]', 'Loading...']);
2397
Scheduler.unstable_advanceTime(100000);
2398
await advanceTimers(100000);
2399
// Even after lots of time has passed, we have still not yet flushed the
@@ -2525,14 +2448,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2448
await act(async () => {
2449
React.startTransition(() => transitionToPage('B'));
2450
2528
- await waitForAll([
2529
- 'Suspend! [B]',
2530
- 'Loading...',
2531
-
2532
- ...(gate('enableSiblingPrerendering')
2533
- ? ['Suspend! [B]', 'Loading...']
2534
- : []),
2535
- ]);
2451
+ await waitForAll(['Suspend! [B]', 'Loading...']);
2452
Scheduler.unstable_advanceTime(100000);
2453
await advanceTimers(100000);
2454
// Even after lots of time has passed, we have still not yet flushed the
@@ -2574,14 +2490,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2490
// Start transition.
2491
React.startTransition(() => ReactNoop.render(<App page="B" />));
2492
2577
- await waitForAll([
2578
- 'Suspend! [B]',
2579
- 'Loading...',
2580
-
2581
- ...(gate('enableSiblingPrerendering')
2582
- ? ['Suspend! [B]', 'Loading...']
2583
- : []),
2584
- ]);
2493
+ await waitForAll(['Suspend! [B]', 'Loading...']);
2494
Scheduler.unstable_advanceTime(2999);
2495
await advanceTimers(2999);
2496
// Since the timeout is infinite (or effectively infinite),
@@ -2595,14 +2504,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2504
2505
// Start a long (infinite) transition.
2506
React.startTransition(() => ReactNoop.render(<App page="C" />));
2598
- await waitForAll([
2599
- 'Suspend! [C]',
2600
- 'Loading...',
2601
-
2602
- ...(gate('enableSiblingPrerendering')
2603
- ? ['Suspend! [C]', 'Loading...']
2604
- : []),
2605
- ]);
2507
+ await waitForAll(['Suspend! [C]', 'Loading...']);
2508
2509
// Even after lots of time has passed, we have still not yet flushed the
2510
// loading state.
@@ -2650,14 +2552,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2552
await act(async () => {
2553
React.startTransition(() => transitionToPage('B'));
2554
2653
- await waitForAll([
2654
- 'Suspend! [B]',
2655
- 'Loading...',
2656
-
2657
- ...(gate('enableSiblingPrerendering')
2658
- ? ['Suspend! [B]', 'Loading...']
2659
- : []),
2660
- ]);
2555
+ await waitForAll(['Suspend! [B]', 'Loading...']);
2556
2557
Scheduler.unstable_advanceTime(2999);
2558
await advanceTimers(2999);
@@ -2675,14 +2570,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2570
await act(async () => {
2571
React.startTransition(() => transitionToPage('C'));
2572
2678
- await waitForAll([
2679
- 'Suspend! [C]',
2680
- 'Loading...',
2681
-
2682
- ...(gate('enableSiblingPrerendering')
2683
- ? ['Suspend! [C]', 'Loading...']
2684
- : []),
2685
- ]);
2573
+ await waitForAll(['Suspend! [C]', 'Loading...']);
2574
2575
// Even after lots of time has passed, we have still not yet flushed the
2576
// loading state.
@@ -2734,14 +2622,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2622
await act(async () => {
2623
React.startTransition(() => transitionToPage('B'));
2624
2737
- await waitForAll([
2738
- 'Suspend! [B]',
2739
- 'Loading...',
2740
-
2741
- ...(gate('enableSiblingPrerendering')
2742
- ? ['Suspend! [B]', 'Loading...']
2743
- : []),
2744
- ]);
2625
+ await waitForAll(['Suspend! [B]', 'Loading...']);
2626
Scheduler.unstable_advanceTime(2999);
2627
await advanceTimers(2999);
2628
// Since the timeout is infinite (or effectively infinite),
@@ -2758,14 +2639,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2639
await act(async () => {
2640
React.startTransition(() => transitionToPage('C'));
2641
2761
- await waitForAll([
2762
- 'Suspend! [C]',
2763
- 'Loading...',
2764
-
2765
- ...(gate('enableSiblingPrerendering')
2766
- ? ['Suspend! [C]', 'Loading...']
2767
- : []),
2768
- ]);
2642
+ await waitForAll(['Suspend! [C]', 'Loading...']);
2643
2644
// Even after lots of time has passed, we have still not yet flushed the
2645
// loading state.
@@ -2806,15 +2680,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2680
// Start transition.
2681
React.startTransition(() => ReactNoop.render(<App page="B" />));
2682
2809
- await waitForAll([
2810
- 'Hi!',
2811
- 'Suspend! [B]',
2812
- 'Loading B...',
2813
-
2814
- ...(gate('enableSiblingPrerendering')
2815
- ? ['Hi!', 'Suspend! [B]', 'Loading B...']
2816
- : []),
2817
- ]);
2683
+ await waitForAll(['Hi!', 'Suspend! [B]', 'Loading B...']);
2684
2685
// Suspended
2686
expect(ReactNoop).toMatchRenderedOutput(
@@ -2875,15 +2741,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2741
// Start transition.
2742
React.startTransition(() => ReactNoop.render(<App page="B" />));
2743
2878
- await waitForAll([
2879
- 'Hi!',
2880
- 'Suspend! [B]',
2881
- 'Loading B...',
2882
-
2883
- ...(gate('enableSiblingPrerendering')
2884
- ? ['Hi!', 'Suspend! [B]', 'Loading B...']
2885
- : []),
2886
- ]);
2744
+ await waitForAll(['Hi!', 'Suspend! [B]', 'Loading B...']);
2745
2746
// Suspended
2747
expect(ReactNoop).toMatchRenderedOutput(
@@ -2997,14 +2855,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2855
ReactNoop.render(<App showContent={true} />);
2856
});
2857
3000
- await waitForAll([
3001
- 'Suspend! [A]',
3002
- 'Loading...',
3003
-
3004
- ...(gate('enableSiblingPrerendering')
3005
- ? ['Suspend! [A]', 'Loading...']
3006
- : []),
3007
- ]);
2858
+ await waitForAll(['Suspend! [A]', 'Loading...']);
2859
await resolveText('A');
2860
await waitFor(['A', 'Commit']);
2861
expect(ReactNoop).toMatchRenderedOutput(
@@ -3056,14 +2907,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
2907
ReactNoop.render(<App showContent={true} />);
2908
});
2909
3059
- await waitForAll([
3060
- 'Suspend! [A]',
3061
- 'Loading...',
3062
-
3063
- ...(gate('enableSiblingPrerendering')
3064
- ? ['Suspend! [A]', 'Loading...']
3065
- : []),
3066
- ]);
2910
+ await waitForAll(['Suspend! [A]', 'Loading...']);
2911
await resolveText('A');
2912
await waitFor(['A', 'Commit']);
2913
expect(ReactNoop).toMatchRenderedOutput(
@@ -3842,16 +3686,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3686
// Update to "a". That will suspend.
3687
await act(async () => {
3688
setTextWithShortTransition('a');
3845
- await waitForAll([
3846
- 'Pending...',
3847
- '',
3848
- 'Suspend! [a]',
3849
- 'Loading...',
3850
-
3851
- ...(gate('enableSiblingPrerendering')
3852
- ? ['Suspend! [a]', 'Loading...']
3853
- : []),
3854
- ]);
3689
+ await waitForAll(['Pending...', '', 'Suspend! [a]', 'Loading...']);
3690
});
3691
assertLog([]);
3692
expect(root).toMatchRenderedOutput(
@@ -3870,10 +3705,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3705
'',
3706
'Suspend! [b]',
3707
'Loading...',
3873
-
3874
- ...(gate('enableSiblingPrerendering')
3875
- ? ['Suspend! [b]', 'Loading...']
3876
- : []),
3708
]);
3709
});
3710
assertLog([]);
@@ -3888,14 +3719,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
3719
await act(async () => {
3720
await resolveText('a');
3721
3891
- await waitForAll([
3892
- 'Suspend! [b]',
3893
- 'Loading...',
3894
-
3895
- ...(gate('enableSiblingPrerendering')
3896
- ? ['Suspend! [b]', 'Loading...']
3897
- : []),
3898
- ]);
3722
+ await waitForAll(['Suspend! [b]', 'Loading...']);
3723
expect(root).toMatchRenderedOutput(
3724
<>
3725
<span prop="Pending..." />
packages/react-reconciler/src/__tests__/ReactTransition-test.js
+8
-72
@@ -199,10 +199,6 @@ describe('ReactTransition', () => {
199
'(empty)',
200
'Suspend! [Async]',
201
'Loading...',
202
-
203
- ...(gate('enableSiblingPrerendering')
204
- ? ['Suspend! [Async]', 'Loading...']
205
- : []),
202
]);
203
204
expect(root).toMatchRenderedOutput('Pending...(empty)');
@@ -273,10 +269,6 @@ describe('ReactTransition', () => {
269
'B label',
270
'Suspend! [B content]',
271
'Loading...',
276
-
277
- ...(gate('enableSiblingPrerendering')
278
- ? ['B label', 'Suspend! [B content]', 'Loading...']
279
- : []),
272
]);
273
// This is a refresh transition so it shouldn't show a fallback
274
expect(root).toMatchRenderedOutput(
@@ -298,10 +290,6 @@ describe('ReactTransition', () => {
290
'C label',
291
'Suspend! [C content]',
292
'Loading...',
301
-
302
- ...(gate('enableSiblingPrerendering')
303
- ? ['C label', 'Suspend! [C content]', 'Loading...']
304
- : []),
293
]);
294
expect(root).toMatchRenderedOutput(
295
<>
@@ -319,10 +307,6 @@ describe('ReactTransition', () => {
307
'C label',
308
'Suspend! [C content]',
309
'Loading...',
322
-
323
- ...(gate('enableSiblingPrerendering')
324
- ? ['C label', 'Suspend! [C content]', 'Loading...']
325
- : []),
310
]);
311
expect(root).toMatchRenderedOutput(
312
<>
@@ -410,10 +394,6 @@ describe('ReactTransition', () => {
394
'B label',
395
'Suspend! [B content]',
396
'Loading...',
413
-
414
- ...(gate('enableSiblingPrerendering')
415
- ? ['B label', 'Suspend! [B content]', 'Loading...']
416
- : []),
397
]);
398
// This is a refresh transition so it shouldn't show a fallback
399
expect(root).toMatchRenderedOutput(
@@ -435,10 +415,6 @@ describe('ReactTransition', () => {
415
'C label',
416
'Suspend! [C content]',
417
'Loading...',
438
-
439
- ...(gate('enableSiblingPrerendering')
440
- ? ['C label', 'Suspend! [C content]', 'Loading...']
441
- : []),
418
]);
419
expect(root).toMatchRenderedOutput(
420
<>
@@ -456,10 +432,6 @@ describe('ReactTransition', () => {
432
'C label',
433
'Suspend! [C content]',
434
'Loading...',
459
-
460
- ...(gate('enableSiblingPrerendering')
461
- ? ['C label', 'Suspend! [C content]', 'Loading...']
462
- : []),
435
]);
436
expect(root).toMatchRenderedOutput(
437
<>
@@ -528,14 +500,7 @@ describe('ReactTransition', () => {
500
setShowA(true);
501
});
502
});
531
- assertLog([
532
- 'Suspend! [A]',
533
- 'Loading...',
534
-
535
- ...(gate('enableSiblingPrerendering')
536
- ? ['Suspend! [A]', 'Loading...']
537
- : []),
538
- ]);
503
+ assertLog(['Suspend! [A]', 'Loading...']);
504
expect(root).toMatchRenderedOutput(null);
505
506
// Before A loads, switch to B. This should entangle A with B.
@@ -545,14 +510,7 @@ describe('ReactTransition', () => {
510
setShowB(true);
511
});
512
});
548
- assertLog([
549
- 'Suspend! [B]',
550
- 'Loading...',
551
-
552
- ...(gate('enableSiblingPrerendering')
553
- ? ['Suspend! [B]', 'Loading...']
554
- : []),
555
- ]);
513
+ assertLog(['Suspend! [B]', 'Loading...']);
514
expect(root).toMatchRenderedOutput(null);
515
516
// Before A or B loads, switch to C. This should entangle C with B, and
@@ -563,14 +521,7 @@ describe('ReactTransition', () => {
521
setShowC(true);
522
});
523
});
566
- assertLog([
567
- 'Suspend! [C]',
568
- 'Loading...',
569
-
570
- ...(gate('enableSiblingPrerendering')
571
- ? ['Suspend! [C]', 'Loading...']
572
- : []),
573
- ]);
524
+ assertLog(['Suspend! [C]', 'Loading...']);
525
expect(root).toMatchRenderedOutput(null);
526
527
// Now the data starts resolving out of order.
@@ -582,14 +533,7 @@ describe('ReactTransition', () => {
533
resolveText('B');
534
});
535
});
585
- assertLog([
586
- 'Suspend! [C]',
587
- 'Loading...',
588
-
589
- ...(gate('enableSiblingPrerendering')
590
- ? ['Suspend! [C]', 'Loading...']
591
- : []),
592
- ]);
536
+ assertLog(['Suspend! [C]', 'Loading...']);
537
expect(root).toMatchRenderedOutput(null);
538
539
// Now resolve A. Again, this will attempt to render C, since everything
@@ -599,14 +543,7 @@ describe('ReactTransition', () => {
543
resolveText('A');
544
});
545
});
602
- assertLog([
603
- 'Suspend! [C]',
604
- 'Loading...',
605
-
606
- ...(gate('enableSiblingPrerendering')
607
- ? ['Suspend! [C]', 'Loading...']
608
- : []),
609
- ]);
546
+ assertLog(['Suspend! [C]', 'Loading...']);
547
expect(root).toMatchRenderedOutput(null);
548
549
// Finally, resolve C. This time we can finish.
@@ -923,11 +860,10 @@ describe('ReactTransition', () => {
860
assertLog([
861
// Suspend.
862
'Suspend! [Async]',
926
- 'Loading...',
863
928
- ...(gate('enableSiblingPrerendering')
929
- ? ['Suspend! [Async]', 'Normal pri: 0', 'Loading...']
930
- : []),
864
+ ...(gate('enableSiblingPrerendering') ? ['Normal pri: 0'] : []),
865
+
866
+ 'Loading...',
867
]);
868
expect(root).toMatchRenderedOutput('(empty), Normal pri: 0');
869
packages/react-reconciler/src/__tests__/ReactUse-test.js
-8
@@ -1885,10 +1885,6 @@ describe('ReactUse', () => {
1885
'A component was suspended by an uncached promise. Creating ' +
1886
'promises inside a Client Component or hook is not yet ' +
1887
'supported, except via a Suspense-compatible library or framework.',
1888
-
1889
- ...(gate('enableSiblingPrerendering')
1890
- ? ['A component was suspended by an uncached promise.']
1891
- : []),
1888
]);
1889
1890
assertLog(['Async text requested [World]']);
@@ -1940,10 +1936,6 @@ describe('ReactUse', () => {
1936
'A component was suspended by an uncached promise. Creating ' +
1937
'promises inside a Client Component or hook is not yet ' +
1938
'supported, except via a Suspense-compatible library or framework.',
1943
-
1944
- ...(gate('enableSiblingPrerendering')
1945
- ? ['A component was suspended by an uncached promise.']
1946
- : []),
1939
]);
1940
1941
assertLog(['Async text requested [World]']);
packages/react-reconciler/src/__tests__/useMemoCache-test.js
+4
-28
@@ -561,26 +561,13 @@ describe('useMemoCache()', () => {
561
root.render(<App chunkA={updatedChunkA} chunkB={updatedChunkB} />);
562
});
563
});
564
- assertLog([
565
- 'Suspend! [chunkA]',
566
-
567
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [chunkA]'] : []),
568
- ]);
564
+ assertLog(['Suspend! [chunkA]']);
565
566
// The data starts to stream in. Loading the data in the first chunk
567
// triggers an expensive computation in the UI. Later, we'll test whether
568
// this computation is reused.
569
await act(() => updatedChunkA.resolve('A2'));
574
- assertLog([
575
- 'Some expensive processing... [A2]',
576
- 'Suspend! [chunkB]',
577
-
578
- ...(gate('enableSiblingPrerendering')
579
- ? gate('enableNoCloningMemoCache')
580
- ? ['Suspend! [chunkB]']
581
- : ['Some expensive processing... [A2]', 'Suspend! [chunkB]']
582
- : []),
583
- ]);
570
+ assertLog(['Some expensive processing... [A2]', 'Suspend! [chunkB]']);
571
572
// The second chunk hasn't loaded yet, so we're still showing the
573
// initial UI.
@@ -601,22 +588,11 @@ describe('useMemoCache()', () => {
588
if (gate(flags => flags.enableNoCloningMemoCache)) {
589
// We did not have process the first chunk again. We reused the
590
// computation from the earlier attempt.
604
- assertLog([
605
- 'Suspend! [chunkB]',
606
-
607
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [chunkB]'] : []),
608
- ]);
591
+ assertLog(['Suspend! [chunkB]']);
592
} else {
593
// Because we clone/reset the memo cache after every aborted attempt, we
594
// must process the first chunk again.
612
- assertLog([
613
- 'Some expensive processing... [A2]',
614
- 'Suspend! [chunkB]',
615
-
616
- ...(gate('enableSiblingPrerendering')
617
- ? ['Some expensive processing... [A2]', 'Suspend! [chunkB]']
618
- : []),
619
- ]);
595
+ assertLog(['Some expensive processing... [A2]', 'Suspend! [chunkB]']);
596
}
597
598
expect(root).toMatchRenderedOutput(
packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
+1
-3
@@ -275,9 +275,7 @@ describe('useSyncExternalStore', () => {
275
// this test, this causes A to suspend.
276
'Suspend A',
277
278
- ...(gate('enableSiblingPrerendering')
279
- ? ['Suspend A', 'B: Updated']
280
- : []),
278
+ ...(gate('enableSiblingPrerendering') ? ['B: Updated'] : []),
279
]);
280
// Nothing has committed, because A suspended and no fallback
281
// was provided.