AB
@@ -402,9 +386,7 @@ describe('ReactSiblingPrerendering', () => {
);
});
// Once the inner fallback is committed, we can start prerendering C.
- assertLog(
- gate('enableSiblingPrerendering') ? ['Suspend! [B]', 'Suspend! [C]'] : [],
- );
+ assertLog(['Suspend! [B]', 'Suspend! [C]']);
});
it(
@@ -488,9 +470,7 @@ describe('ReactSiblingPrerendering', () => {
await waitForPaint([]);
}
// Now we can proceed to prerendering C.
- if (gate('enableSiblingPrerendering')) {
- await waitForPaint(['Suspend! [B]', 'Suspend! [C]']);
- }
+ await waitForPaint(['Suspend! [B]', 'Suspend! [C]']);
});
assertLog([]);
},
@@ -519,12 +499,10 @@ describe('ReactSiblingPrerendering', () => {
// Synchronously render everything until we suspend in the shell
assertLog(['A', 'B', 'Suspend! [Async]']);
- if (gate('enableSiblingPrerendering')) {
- // The rest of the siblings begin to prerender concurrently. Notice
- // that we don't unwind here; we pick up where we left off above.
- await waitFor(['C']);
- await waitFor(['D']);
- }
+ // The rest of the siblings begin to prerender concurrently. Notice
+ // that we don't unwind here; we pick up where we left off above.
+ await waitFor(['C']);
+ await waitFor(['D']);
assertLog([]);
expect(root).toMatchRenderedOutput(null);
@@ -555,10 +533,8 @@ describe('ReactSiblingPrerendering', () => {
// Synchronously render everything until we suspend in the shell
assertLog(['A', 'B', 'Suspend! [Async]']);
- if (gate('enableSiblingPrerendering')) {
- // The rest of the siblings begin to prerender concurrently
- await waitFor(['C']);
- }
+ // The rest of the siblings begin to prerender concurrently
+ await waitFor(['C']);
// While we're prerendering, Async resolves. We should unwind and
// start over, rather than continue prerendering D.
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
index d7ad652f1da7e..8657365b063aa 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js
@@ -135,9 +135,9 @@ describe('ReactSuspense', () => {
'Bar',
// A suspends
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering') ? ['B'] : []),
-
+ // pre-warming
+ 'B',
+ // end pre-warming
'Loading...',
]);
expect(container.textContent).toEqual('');
@@ -169,10 +169,9 @@ describe('ReactSuspense', () => {
'Loading A...',
'Suspend! [B]',
'Loading B...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
]);
expect(container.innerHTML).toEqual('Loading A...Loading B...');
@@ -181,8 +180,7 @@ describe('ReactSuspense', () => {
await act(() => resolveText('A'));
assertLog([
'A',
-
- ...(gate('enableSiblingPrerendering')
+ ...(gate('alwaysThrottleRetries')
? ['Suspend! [B]', 'Suspend! [B]']
: []),
]);
@@ -288,10 +286,10 @@ describe('ReactSuspense', () => {
'Foo',
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]', 'Loading more...']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
+ 'Loading more...',
]);
expect(container.textContent).toEqual('Loading...');
@@ -341,10 +339,10 @@ describe('ReactSuspense', () => {
'Foo',
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]', 'Loading more...']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
+ 'Loading more...',
]);
expect(container.textContent).toEqual('Loading...');
@@ -390,10 +388,10 @@ describe('ReactSuspense', () => {
'Foo',
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]', 'Loading more...']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
+ 'Loading more...',
]);
expect(container.textContent).toEqual('Loading...');
@@ -482,8 +480,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [default]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [default]'] : []),
+ // pre-warming
+ 'Suspend! [default]',
]);
await act(() => resolveText('default'));
@@ -494,8 +492,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [new value]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [new value]'] : []),
+ // pre-warming
+ 'Suspend! [new value]',
]);
await act(() => resolveText('new value'));
@@ -539,8 +537,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [default]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [default]'] : []),
+ // pre-warming
+ 'Suspend! [default]',
]);
await act(() => resolveText('default'));
@@ -551,8 +549,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [new value]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [new value]'] : []),
+ // pre-warming
+ 'Suspend! [new value]',
]);
await act(() => resolveText('new value'));
@@ -593,8 +591,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [default]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [default]'] : []),
+ // pre-warming
+ 'Suspend! [default]',
]);
await act(() => resolveText('default'));
@@ -605,8 +603,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [new value]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [new value]'] : []),
+ // pre-warming
+ 'Suspend! [new value]',
]);
await act(() => resolveText('new value'));
@@ -647,8 +645,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [default]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [default]'] : []),
+ // pre-warming
+ 'Suspend! [default]',
]);
await act(() => resolveText('default'));
@@ -659,8 +657,8 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [new value]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [new value]'] : []),
+ // pre-warming
+ 'Suspend! [new value]',
]);
await act(() => resolveText('new value'));
@@ -708,10 +706,9 @@ describe('ReactSuspense', () => {
'Suspend! [Child 2]',
'Loading...',
'destroy layout',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Child 1', 'Suspend! [Child 2]']
- : []),
+ // pre-warming
+ 'Child 1',
+ 'Suspend! [Child 2]',
]);
await act(() => resolveText('Child 2'));
@@ -737,13 +734,18 @@ describe('ReactSuspense', () => {
assertLog([
'Suspend! [Child 1]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [Child 1]', 'Suspend! [Child 2]']
- : []),
+ // pre-warming
+ 'Suspend! [Child 1]',
+ 'Suspend! [Child 2]',
]);
await resolveText('Child 1');
- await waitForAll(['Child 1', 'Suspend! [Child 2]']);
+ await waitForAll([
+ 'Child 1',
+ 'Suspend! [Child 2]',
+ ...(gate('alwaysThrottleRetries')
+ ? []
+ : ['Child 1', 'Suspend! [Child 2]']),
+ ]);
jest.advanceTimersByTime(6000);
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js
index 921c9666a935e..866e87bd6c4bd 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js
@@ -60,9 +60,17 @@ describe('ReactSuspense', () => {
ReactNoop.render(elementBadType);
await waitForAll([]);
- assertConsoleErrorDev(['Unexpected type for suspenseCallback.'], {
- withoutStack: true,
- });
+ assertConsoleErrorDev(
+ [
+ 'Unexpected type for suspenseCallback.',
+ ...(gate('alwaysThrottleRetries')
+ ? []
+ : ['Unexpected type for suspenseCallback.']),
+ ],
+ {
+ withoutStack: true,
+ },
+ );
const elementMissingCallback = (
@@ -93,7 +101,10 @@ describe('ReactSuspense', () => {
ReactNoop.render(element);
await waitForAll([]);
expect(ReactNoop).toMatchRenderedOutput('Waiting');
- expect(ops).toEqual([new Set([promise])]);
+ expect(ops).toEqual([
+ new Set([promise]),
+ ...(gate('alwaysThrottleRetries') ? [] : new Set([promise])),
+ ]);
ops = [];
await act(() => resolve());
@@ -132,7 +143,10 @@ describe('ReactSuspense', () => {
ReactNoop.render(element);
await waitForAll([]);
expect(ReactNoop).toMatchRenderedOutput('Waiting Tier 1');
- expect(ops).toEqual([new Set([promise1])]);
+ expect(ops).toEqual([
+ new Set([promise1]),
+ ...(gate('alwaysThrottleRetries') ? [] : new Set([promise1, promise2])),
+ ]);
ops = [];
await act(() => resolve1());
@@ -141,8 +155,8 @@ describe('ReactSuspense', () => {
expect(ReactNoop).toMatchRenderedOutput('Waiting Tier 1');
expect(ops).toEqual([
new Set([promise2]),
-
- ...(gate('enableSiblingPrerendering') ? new Set([promise2]) : []),
+ // pre-warming
+ new Set([promise2]),
]);
ops = [];
@@ -182,7 +196,10 @@ describe('ReactSuspense', () => {
await waitForAll([]);
expect(ReactNoop).toMatchRenderedOutput('Waiting Tier 2');
expect(ops1).toEqual([]);
- expect(ops2).toEqual([new Set([promise])]);
+ expect(ops2).toEqual([
+ new Set([promise]),
+ ...(gate('alwaysThrottleRetries') ? [] : [new Set([promise])]),
+ ]);
});
// @gate enableSuspenseCallback
@@ -231,11 +248,7 @@ describe('ReactSuspense', () => {
await act(() => resolve1());
expect(ReactNoop).toMatchRenderedOutput('Waiting Tier 2Done');
expect(ops1).toEqual([]);
- expect(ops2).toEqual([
- new Set([promise2]),
-
- ...(gate('enableSiblingPrerendering') ? new Set([promise2]) : []),
- ]);
+ expect(ops2).toEqual([new Set([promise2]), new Set([promise2])]);
ops1 = [];
ops2 = [];
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js
index d45b29aee59ef..9fc94d7d0eee4 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspenseEffectsSemantics-test.js
@@ -283,14 +283,10 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create passive',
'Text:Outside create passive',
'App create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Inside:Before render',
- 'Suspend:Async',
- 'ClassText:Inside:After render',
- ]
- : []),
+ // pre-warming
+ 'Text:Inside:Before render',
+ 'Suspend:Async',
+ 'ClassText:Inside:After render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -687,14 +683,10 @@ describe('ReactSuspenseEffectsSemantics', () => {
]);
await waitForAll([
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Inside:Before render',
- 'Suspend:Async',
- 'Text:Inside:After render',
- ]
- : []),
+ // pre-warming
+ 'Text:Inside:Before render',
+ 'Suspend:Async',
+ 'Text:Inside:After render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -850,13 +842,12 @@ describe('ReactSuspenseEffectsSemantics', () => {
>,
);
});
- if (gate('enableSiblingPrerendering')) {
- assertLog([
- 'ClassText:Inside:Before render',
- 'Suspend:Async',
- 'ClassText:Inside:After render',
- ]);
- }
+ // pre-warming
+ assertLog([
+ 'ClassText:Inside:Before render',
+ 'Suspend:Async',
+ 'ClassText:Inside:After render',
+ ]);
// Resolving the suspended resource should re-create inner layout effects.
await act(async () => {
@@ -961,10 +952,10 @@ describe('ReactSuspenseEffectsSemantics', () => {
]);
await waitForAll([
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend:Async', 'Text:Outer render', 'Text:Inner render']
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'Text:Outer render',
+ 'Text:Inner render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1088,10 +1079,9 @@ describe('ReactSuspenseEffectsSemantics', () => {
]);
await waitForAll([
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend:Async', 'Text:Outer render']
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'Text:Outer render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1195,10 +1185,9 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:InnerFallback create insertion',
'Text:InnerFallback create layout',
'Text:InnerFallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Text:Inner render', 'Suspend:InnerAsync_1']
- : []),
+ // pre-warming
+ 'Text:Inner render',
+ 'Suspend:InnerAsync_1',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1228,16 +1217,12 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:OuterFallback create insertion',
'Text:OuterFallback create layout',
'Text:OuterFallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Outer render',
- 'Suspend:OuterAsync_1',
- 'Text:Inner render',
- 'Suspend:InnerAsync_1',
- 'Text:InnerFallback render',
- ]
- : []),
+ // pre-warming
+ 'Text:Outer render',
+ 'Suspend:OuterAsync_1',
+ 'Text:Inner render',
+ 'Suspend:InnerAsync_1',
+ 'Text:InnerFallback render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1255,15 +1240,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
assertLog([
'Text:Outer render',
'Suspend:OuterAsync_1',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Outer render',
- 'Suspend:OuterAsync_1',
- 'Text:Inner render',
- 'AsyncText:InnerAsync_1 render',
- ]
- : []),
+ // pre-warming
+ 'Text:Outer render',
+ 'Suspend:OuterAsync_1',
+ 'Text:Inner render',
+ 'AsyncText:InnerAsync_1 render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1288,16 +1269,12 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Outer render',
'Suspend:OuterAsync_1',
'Text:OuterFallback render',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Outer render',
- 'Suspend:OuterAsync_1',
- 'Text:Inner render',
- 'Suspend:InnerAsync_2',
- 'Text:InnerFallback render',
- ]
- : []),
+ // pre-warming
+ 'Text:Outer render',
+ 'Suspend:OuterAsync_1',
+ 'Text:Inner render',
+ 'Suspend:InnerAsync_2',
+ 'Text:InnerFallback render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1325,10 +1302,9 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:InnerFallback create layout',
'Text:OuterFallback destroy passive',
'AsyncText:OuterAsync_1 create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Text:Inner render', 'Suspend:InnerAsync_2']
- : []),
+ // pre-warming
+ 'Text:Inner render',
+ 'Suspend:InnerAsync_2',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1382,15 +1358,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:OuterFallback create insertion',
'Text:OuterFallback create layout',
'Text:OuterFallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Outer render',
- 'Suspend:OuterAsync_2',
- 'Text:Inner render',
- 'AsyncText:InnerAsync_2 render',
- ]
- : []),
+ // pre-warming
+ 'Text:Outer render',
+ 'Suspend:OuterAsync_2',
+ 'Text:Inner render',
+ 'AsyncText:InnerAsync_2 render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1480,10 +1452,9 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:InnerFallback create insertion',
'Text:InnerFallback create layout',
'Text:InnerFallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Text:Inner render', 'Suspend:InnerAsync_1']
- : []),
+ // pre-warming
+ 'Text:Inner render',
+ 'Suspend:InnerAsync_1',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1512,16 +1483,12 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:OuterFallback create insertion',
'Text:OuterFallback create layout',
'Text:OuterFallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Outer render',
- 'Suspend:OuterAsync_1',
- 'Text:Inner render',
- 'Suspend:InnerAsync_1',
- 'Text:InnerFallback render',
- ]
- : []),
+ // pre-warming
+ 'Text:Outer render',
+ 'Suspend:OuterAsync_1',
+ 'Text:Inner render',
+ 'Suspend:InnerAsync_1',
+ 'Text:InnerFallback render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1630,10 +1597,9 @@ describe('ReactSuspenseEffectsSemantics', () => {
await waitForAll([
'Text:Fallback:Inside create passive',
'Text:Fallback:Outside create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Text:Inside render', 'Suspend:OutsideAsync']
- : []),
+ // pre-warming
+ 'Text:Inside render',
+ 'Suspend:OutsideAsync',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1667,15 +1633,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
]);
await waitForAll([
'Text:Fallback:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Inside render',
- 'Suspend:OutsideAsync',
- 'Text:Fallback:Inside render',
- 'Suspend:FallbackAsync',
- ]
- : []),
+ // pre-warming
+ 'Text:Inside render',
+ 'Suspend:OutsideAsync',
+ 'Text:Fallback:Inside render',
+ 'Suspend:FallbackAsync',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1787,15 +1749,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback:Outside create layout',
'Text:Fallback:Fallback create passive',
'Text:Fallback:Outside create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Inside render',
- 'Suspend:OutsideAsync',
- 'Text:Fallback:Inside render',
- 'Suspend:FallbackAsync',
- ]
- : []),
+ // pre-warming
+ 'Text:Inside render',
+ 'Suspend:OutsideAsync',
+ 'Text:Fallback:Inside render',
+ 'Suspend:FallbackAsync',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -1915,8 +1873,8 @@ describe('ReactSuspenseEffectsSemantics', () => {
]);
await waitForAll([
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend:Suspend'] : []),
+ // pre-warming
+ 'Suspend:Suspend',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2038,10 +1996,10 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend:Async', 'ThrowsInDidMount render', 'Text:Inside render']
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'ThrowsInDidMount render',
+ 'Text:Inside render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2301,14 +2259,10 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend:Async',
- 'ThrowsInLayoutEffect render',
- 'Text:Inside render',
- ]
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'ThrowsInLayoutEffect render',
+ 'Text:Inside render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2555,14 +2509,13 @@ describe('ReactSuspenseEffectsSemantics', () => {
);
});
- if (gate('enableSiblingPrerendering')) {
- assertLog([
- 'Text:Function render',
- 'Suspend:Async_1',
- 'Suspend:Async_2',
- 'ClassText:Class render',
- ]);
- }
+ // pre-warming
+ assertLog([
+ 'Text:Function render',
+ 'Suspend:Async_1',
+ 'Suspend:Async_2',
+ 'ClassText:Class render',
+ ]);
// Resolving the suspended resource should re-create inner layout effects.
await act(async () => {
@@ -2572,15 +2525,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Function render',
'AsyncText:Async_1 render',
'Suspend:Async_2',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Function render',
- 'AsyncText:Async_1 render',
- 'Suspend:Async_2',
- 'ClassText:Class render',
- ]
- : []),
+ // pre-warming
+ 'Text:Function render',
+ 'AsyncText:Async_1 render',
+ 'Suspend:Async_2',
+ 'ClassText:Class render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2715,14 +2664,14 @@ describe('ReactSuspenseEffectsSemantics', () => {
>,
);
});
- if (gate('enableSiblingPrerendering')) {
- assertLog([
- 'Text:Function render',
- 'Suspender "A" render',
- 'Suspend:A',
- 'ClassText:Class render',
- ]);
- }
+
+ // pre-warming
+ assertLog([
+ 'Text:Function render',
+ 'Suspender "A" render',
+ 'Suspend:A',
+ 'ClassText:Class render',
+ ]);
// Resolving the suspended resource should re-create inner layout effects.
textToRead = 'B';
@@ -2733,15 +2682,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Function render',
'Suspender "B" render',
'Suspend:B',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Text:Function render',
- 'Suspender "B" render',
- 'Suspend:B',
- 'ClassText:Class render',
- ]
- : []),
+ // pre-warming
+ 'Text:Function render',
+ 'Suspender "B" render',
+ 'Suspend:B',
+ 'ClassText:Class render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2977,15 +2922,11 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend:Async',
- 'RefCheckerOuter render',
- 'RefCheckerInner:refObject render',
- 'RefCheckerInner:refCallback render',
- ]
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'RefCheckerOuter render',
+ 'RefCheckerInner:refObject render',
+ 'RefCheckerInner:refCallback render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -3089,17 +3030,13 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend:Async',
- 'RefCheckerOuter render',
- 'ClassComponent:refObject render',
- 'RefCheckerInner:refObject render',
- 'ClassComponent:refCallback render',
- 'RefCheckerInner:refCallback render',
- ]
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'RefCheckerOuter render',
+ 'ClassComponent:refObject render',
+ 'RefCheckerInner:refObject render',
+ 'ClassComponent:refCallback render',
+ 'RefCheckerInner:refCallback render',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -3199,17 +3136,13 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend:Async',
- 'RefCheckerOuter render',
- 'FunctionComponent render',
- 'RefCheckerInner:refObject render',
- 'FunctionComponent render',
- 'RefCheckerInner:refCallback render',
- ]
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'RefCheckerOuter render',
+ 'FunctionComponent render',
+ 'RefCheckerInner:refObject render',
+ 'FunctionComponent render',
+ 'RefCheckerInner:refCallback render',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -3311,10 +3244,9 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend:Async', 'RefChecker render']
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'RefChecker render',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -3433,14 +3365,10 @@ describe('ReactSuspenseEffectsSemantics', () => {
'Text:Fallback create insertion',
'Text:Fallback create layout',
'Text:Fallback create passive',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend:Async',
- 'ThrowsInRefCallback render',
- 'Text:Inside render',
- ]
- : []),
+ // pre-warming
+ 'Suspend:Async',
+ 'ThrowsInRefCallback render',
+ 'Text:Inside render',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js
index 2a6664c0dc2de..836ed7aac826b 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspenseFallback-test.js
@@ -142,8 +142,8 @@ describe('ReactSuspenseFallback', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput();
});
@@ -159,8 +159,8 @@ describe('ReactSuspenseFallback', () => {
await waitForAll([
'Suspend! [A]',
// null
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(null);
});
@@ -176,8 +176,8 @@ describe('ReactSuspenseFallback', () => {
await waitForAll([
'Suspend! [A]',
// null
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(null);
});
@@ -195,8 +195,8 @@ describe('ReactSuspenseFallback', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput();
});
@@ -214,8 +214,8 @@ describe('ReactSuspenseFallback', () => {
await waitForAll([
'Suspend! [A]',
// null
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(null);
});
@@ -233,8 +233,8 @@ describe('ReactSuspenseFallback', () => {
await waitForAll([
'Suspend! [A]',
// null
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(null);
});
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
index 7cfe72dfc4ec8..6faeae3acba0d 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
@@ -245,9 +245,9 @@ describe('ReactSuspenseList', () => {
'Loading B',
'Suspend! [C]',
'Loading C',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [B]', 'Suspend! [C]']
- : []),
+ // pre-warming
+ 'Suspend! [B]',
+ 'Suspend! [C]',
]);
expect(ReactNoop).toMatchRenderedOutput(
@@ -260,7 +260,7 @@ describe('ReactSuspenseList', () => {
await act(() => C.resolve());
assertLog(
- gate('enableSiblingPrerendering')
+ gate('alwaysThrottleRetries')
? ['Suspend! [B]', 'C', 'Suspend! [B]']
: ['C'],
);
@@ -746,7 +746,8 @@ describe('ReactSuspenseList', () => {
await waitForAll([
'Suspend! [A]',
'Loading',
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(Loading);
@@ -919,8 +920,8 @@ describe('ReactSuspenseList', () => {
'Loading A',
'Loading B',
'Loading C',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(
@@ -932,12 +933,7 @@ describe('ReactSuspenseList', () => {
);
await act(() => A.resolve());
- assertLog([
- 'A',
- 'Suspend! [B]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
- ]);
+ assertLog(['A', 'Suspend! [B]', 'Suspend! [B]']);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -990,8 +986,8 @@ describe('ReactSuspenseList', () => {
'Loading C',
'Loading B',
'Loading A',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [C]'] : []),
+ // pre-warming
+ 'Suspend! [C]',
]);
expect(ReactNoop).toMatchRenderedOutput(
@@ -1006,8 +1002,8 @@ describe('ReactSuspenseList', () => {
assertLog([
'C',
'Suspend! [B]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
expect(ReactNoop).toMatchRenderedOutput(
@@ -1133,8 +1129,8 @@ describe('ReactSuspenseList', () => {
'A',
'C',
'Suspend! [E]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [E]'] : []),
+ // pre-warming
+ 'Suspend! [E]',
]);
// We can now resolve the full head.
@@ -1153,8 +1149,8 @@ describe('ReactSuspenseList', () => {
assertLog([
'E',
'Suspend! [F]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [F]'] : []),
+ // pre-warming
+ 'Suspend! [F]',
]);
// In the tail we can resolve one-by-one.
@@ -1296,10 +1292,9 @@ describe('ReactSuspenseList', () => {
'E',
'Suspend! [F]',
'Loading F',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [D]', 'Suspend! [F]']
- : []),
+ // pre-warming
+ 'Suspend! [D]',
+ 'Suspend! [F]',
]);
// This will suspend, since the boundaries are avoided. Give them
@@ -1347,8 +1342,8 @@ describe('ReactSuspenseList', () => {
'D',
'F',
'Suspend! [B]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
// We can now resolve the full head.
@@ -1369,8 +1364,8 @@ describe('ReactSuspenseList', () => {
assertLog([
'B',
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// In the tail we can resolve one-by-one.
@@ -1493,8 +1488,8 @@ describe('ReactSuspenseList', () => {
await waitForAll([
'Suspend! [A]',
'Loading A',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(Loading A);
@@ -2007,8 +2002,8 @@ describe('ReactSuspenseList', () => {
'Suspend! [D]',
'Loading D',
'Loading E',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
// This is suspended due to the update to D causing a loading state.
@@ -2030,7 +2025,11 @@ describe('ReactSuspenseList', () => {
await B.resolve();
- await waitForAll(['B', 'Suspend! [C]']);
+ await waitForAll([
+ 'B',
+ 'Suspend! [C]',
+ ...(!gate('alwaysThrottleRetries') ? ['Suspend! [C]'] : []),
+ ]);
// Incremental loading is suspended.
jest.advanceTimersByTime(500);
@@ -2425,8 +2424,8 @@ describe('ReactSuspenseList', () => {
'A',
'Suspend! [B]',
'Loading B',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
expect(ReactNoop).toMatchRenderedOutput(
@@ -2511,8 +2510,8 @@ describe('ReactSuspenseList', () => {
await waitForAll([
'Suspend! [A]',
'Loading A',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(Loading A);
});
@@ -2795,8 +2794,8 @@ describe('ReactSuspenseList', () => {
'B',
'Suspend! [C]',
'Fallback',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [C]'] : []),
+ // pre-warming
+ 'Suspend! [C]',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2805,7 +2804,9 @@ describe('ReactSuspenseList', () => {
Loading...
>,
);
- expect(onRender).toHaveBeenCalledTimes(1);
+ expect(onRender).toHaveBeenCalledTimes(
+ gate('alwaysThrottleRetries') ? 1 : 2,
+ );
// The treeBaseDuration should be the time to render each child. The last
// one counts the fallback time.
@@ -2828,12 +2829,18 @@ describe('ReactSuspenseList', () => {
C
>,
);
- expect(onRender).toHaveBeenCalledTimes(2);
+ expect(onRender).toHaveBeenCalledTimes(
+ gate('alwaysThrottleRetries') ? 2 : 3,
+ );
// actualDuration
- expect(onRender.mock.calls[1][2]).toBe(1 + 4 + 5);
+ expect(onRender.mock.calls[1][2]).toBe(
+ gate('alwaysThrottleRetries') ? 1 + 4 + 5 : 5,
+ );
// treeBaseDuration
- expect(onRender.mock.calls[1][3]).toBe(1 + 4 + 5);
+ expect(onRender.mock.calls[1][3]).toBe(
+ gate('alwaysThrottleRetries') ? 1 + 4 + 5 : 8,
+ );
ReactNoop.render();
@@ -2850,8 +2857,8 @@ describe('ReactSuspenseList', () => {
'Fallback',
// Lastly we render the tail.
'Fallback',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [C]'] : []),
+ // pre-warming
+ 'Suspend! [C]',
]);
// Flush suspended time.
@@ -2867,7 +2874,7 @@ describe('ReactSuspenseList', () => {
>,
);
expect(onRender).toHaveBeenCalledTimes(
- gate('enableSiblingPrerendering') ? 4 : 3,
+ gate('alwaysThrottleRetries') ? 4 : 5,
);
// The treeBaseDuration should be the time to render the first two
@@ -2877,16 +2884,20 @@ describe('ReactSuspenseList', () => {
// with force fallback mode.
// actualDuration
- expect(onRender.mock.calls[2][2]).toBe((1 + 4 + 5 + 3) * 2 + 3);
+ expect(onRender.mock.calls[2][2]).toBe(
+ gate('alwaysThrottleRetries') ? (1 + 4 + 5 + 3) * 2 + 3 : 10,
+ );
// treeBaseDuration
- expect(onRender.mock.calls[2][3]).toBe(1 + 4 + 3 + 3);
+ expect(onRender.mock.calls[2][3]).toBe(
+ gate('alwaysThrottleRetries') ? 1 + 4 + 3 + 3 : 10,
+ );
await act(() => C.resolve());
assertLog([
'C',
'Suspend! [D]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [D]'] : []),
+ // pre-warming
+ 'Suspend! [D]',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2897,21 +2908,16 @@ describe('ReactSuspenseList', () => {
>,
);
- if (gate('enableSiblingPrerendering')) {
- expect(onRender).toHaveBeenCalledTimes(6);
-
- // actualDuration
- expect(onRender.mock.calls[5][2]).toBe(12);
- // treeBaseDuration
- expect(onRender.mock.calls[5][3]).toBe(1 + 4 + 5 + 3);
- } else {
- expect(onRender).toHaveBeenCalledTimes(4);
+ expect(onRender).toHaveBeenCalledTimes(
+ gate('alwaysThrottleRetries') ? 6 : 7,
+ );
- // actualDuration
- expect(onRender.mock.calls[3][2]).toBe(5 + 12);
- // treeBaseDuration
- expect(onRender.mock.calls[3][3]).toBe(1 + 4 + 5 + 3);
- }
+ // actualDuration
+ expect(onRender.mock.calls[5][2]).toBe(
+ gate('alwaysThrottleRetries') ? 12 : 17,
+ );
+ // treeBaseDuration
+ expect(onRender.mock.calls[5][3]).toBe(1 + 4 + 5 + 3);
});
// @gate enableSuspenseList
@@ -2977,8 +2983,8 @@ describe('ReactSuspenseList', () => {
'Loading A',
'Loading B',
'Loading C',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput(
@@ -2990,12 +2996,7 @@ describe('ReactSuspenseList', () => {
);
await act(() => A.resolve());
- assertLog([
- 'A',
- 'Suspend! [B]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
- ]);
+ assertLog(['A', 'Suspend! [B]', 'Suspend! [B]']);
expect(ReactNoop).toMatchRenderedOutput(
<>
A
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js
index c24169c43f1f2..196022d8a3834 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js
@@ -139,8 +139,10 @@ describe('ReactSuspensePlaceholder', () => {
'A',
'Suspend! [B]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['A', 'Suspend! [B]', 'C'] : []),
+ // pre-warming
+ 'A',
+ 'Suspend! [B]',
+ 'C',
]);
expect(ReactNoop).toMatchRenderedOutput('Loading...');
@@ -160,8 +162,9 @@ describe('ReactSuspensePlaceholder', () => {
await waitForAll([
'Suspend! [B2]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B2]', 'C'] : []),
+ // pre-warming
+ 'Suspend! [B2]',
+ 'C',
]);
// Time out the update
@@ -209,8 +212,10 @@ describe('ReactSuspensePlaceholder', () => {
'A',
'Suspend! [B]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['A', 'Suspend! [B]', 'C'] : []),
+ // pre-warming
+ 'A',
+ 'Suspend! [B]',
+ 'C',
]);
expect(ReactNoop).not.toMatchRenderedOutput('ABC');
@@ -225,8 +230,10 @@ describe('ReactSuspensePlaceholder', () => {
'A',
'Suspend! [B2]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['A', 'Suspend! [B2]', 'C'] : []),
+ // pre-warming
+ 'A',
+ 'Suspend! [B2]',
+ 'C',
]);
// Time out the update
jest.advanceTimersByTime(750);
@@ -264,8 +271,10 @@ describe('ReactSuspensePlaceholder', () => {
'a',
'Suspend! [b]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['a', 'Suspend! [b]', 'c'] : []),
+ // pre-warming
+ 'a',
+ 'Suspend! [b]',
+ 'c',
]);
expect(ReactNoop).toMatchRenderedOutput(LOADING...);
@@ -280,8 +289,9 @@ describe('ReactSuspensePlaceholder', () => {
'a',
'Suspend! [b2]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['a', 'Suspend! [b2]', 'c'] : []),
+ 'a',
+ 'Suspend! [b2]',
+ 'c',
]);
// Time out the update
jest.advanceTimersByTime(750);
@@ -375,15 +385,17 @@ describe('ReactSuspensePlaceholder', () => {
'Suspending',
'Suspend! [Loaded]',
'Fallback',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspending', 'Suspend! [Loaded]', 'Text']
- : []),
+ // pre-warming
+ 'Suspending',
+ 'Suspend! [Loaded]',
+ 'Text',
]);
// Since this is initial render we immediately commit the fallback. Another test below
// deals with the update case where this suspends.
expect(ReactNoop).toMatchRenderedOutput('Loading...');
- expect(onRender).toHaveBeenCalledTimes(1);
+ expect(onRender).toHaveBeenCalledTimes(
+ gate('alwaysThrottleRetries') ? 1 : 2,
+ );
// Initial mount only shows the "Loading..." Fallback.
// The treeBaseDuration then should be 10ms spent rendering Fallback,
@@ -401,21 +413,12 @@ describe('ReactSuspensePlaceholder', () => {
]);
expect(ReactNoop).toMatchRenderedOutput('LoadedText');
- if (gate('enableSiblingPrerendering')) {
- expect(onRender).toHaveBeenCalledTimes(3);
-
- // When the suspending data is resolved and our final UI is rendered,
- // both times should include the 8ms re-rendering Suspending and AsyncText.
- expect(onRender.mock.calls[2][2]).toBe(8);
- expect(onRender.mock.calls[2][3]).toBe(8);
- } else {
- expect(onRender).toHaveBeenCalledTimes(2);
-
- // When the suspending data is resolved and our final UI is rendered,
- // both times should include the 8ms re-rendering Suspending and AsyncText.
- expect(onRender.mock.calls[1][2]).toBe(8);
- expect(onRender.mock.calls[1][3]).toBe(8);
- }
+ expect(onRender).toHaveBeenCalledTimes(3);
+
+ // When the suspending data is resolved and our final UI is rendered,
+ // both times should include the 8ms re-rendering Suspending and AsyncText.
+ expect(onRender.mock.calls[2][2]).toBe(8);
+ expect(onRender.mock.calls[2][3]).toBe(8);
});
});
@@ -536,14 +539,16 @@ describe('ReactSuspensePlaceholder', () => {
'Suspending',
'Suspend! [Loaded]',
'Fallback',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspending', 'Suspend! [Loaded]', 'Text']
- : []),
+ // pre-warming
+ 'Suspending',
+ 'Suspend! [Loaded]',
+ 'Text',
]);
// Show the fallback UI.
expect(ReactNoop).toMatchRenderedOutput('Loading...');
- expect(onRender).toHaveBeenCalledTimes(2);
+ expect(onRender).toHaveBeenCalledTimes(
+ gate('alwaysThrottleRetries') ? 2 : 3,
+ );
jest.advanceTimersByTime(900);
@@ -579,15 +584,16 @@ describe('ReactSuspensePlaceholder', () => {
'Suspend! [Loaded]',
'Fallback',
'Suspend! [Sibling]',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspending', 'Suspend! [Loaded]', 'New', 'Suspend! [Sibling]']
- : []),
+ // pre-warming
+ 'Suspending',
+ 'Suspend! [Loaded]',
+ 'New',
+ 'Suspend! [Sibling]',
]);
expect(ReactNoop).toMatchRenderedOutput('Loading...');
expect(onRender).toHaveBeenCalledTimes(
- gate('enableSiblingPrerendering') ? 4 : 3,
+ gate('alwaysThrottleRetries') ? 4 : 5,
);
// Resolve the pending promise.
@@ -600,23 +606,17 @@ describe('ReactSuspensePlaceholder', () => {
await waitForAll(['Suspending', 'Loaded', 'New', 'Sibling']);
});
- if (gate('enableSiblingPrerendering')) {
- expect(onRender).toHaveBeenCalledTimes(5);
-
- // When the suspending data is resolved and our final UI is rendered,
- // both times should include the 6ms rendering Text,
- // the 2ms rendering Suspending, and the 1ms rendering AsyncText.
- expect(onRender.mock.calls[4][2]).toBe(9);
- expect(onRender.mock.calls[4][3]).toBe(9);
- } else {
- expect(onRender).toHaveBeenCalledTimes(4);
-
- // When the suspending data is resolved and our final UI is rendered,
- // both times should include the 6ms rendering Text,
- // the 2ms rendering Suspending, and the 1ms rendering AsyncText.
- expect(onRender.mock.calls[3][2]).toBe(9);
- expect(onRender.mock.calls[3][3]).toBe(9);
- }
+ expect(onRender).toHaveBeenCalledTimes(
+ gate('alwaysThrottleRetries') ? 5 : 6,
+ );
+
+ // When the suspending data is resolved and our final UI is rendered,
+ // both times should include the 6ms rendering Text,
+ // the 2ms rendering Suspending, and the 1ms rendering AsyncText.
+ expect(onRender.mock.calls[4][2]).toBe(9);
+ expect(onRender.mock.calls[4][3]).toBe(
+ gate('alwaysThrottleRetries') ? 9 : 10,
+ );
});
});
});
diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js
index 79968949e3d99..3637093529f9a 100644
--- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js
@@ -296,7 +296,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// A suspends
'Suspend! [A]',
- ...(gate('enableSiblingPrerendering') ? ['B'] : []),
+ // pre-warming
+ 'B',
+ // end pre-warming
// We immediately unwind and switch to a fallback without
// rendering siblings.
@@ -334,10 +336,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Loading A...',
'Suspend! [B]',
'Loading B...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -351,8 +352,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await act(() => resolveText('A'));
assertLog([
'A',
-
- ...(gate('enableSiblingPrerendering')
+ ...(gate('alwaysThrottleRetries')
? ['Suspend! [B]', 'Suspend! [B]']
: []),
]);
@@ -395,9 +395,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'A',
'Suspend! [B]',
-
- ...(gate('enableSiblingPrerendering') ? ['C', 'D'] : []),
-
+ // pre-warming
+ 'C',
+ 'D',
+ // end pre-warming
'Loading...',
]);
// Did not commit yet.
@@ -509,8 +510,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [Result]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Result]'] : []),
+ // pre-warming
+ 'Suspend! [Result]',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -562,8 +563,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'A',
'Suspend! [1]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [1]'] : []),
+ // pre-warming
+ 'Suspend! [1]',
]);
await act(() => resolveText('1'));
@@ -631,9 +632,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
});
await waitForAll([
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering') ? ['B'] : []),
-
+ // pre-warming
+ 'B',
+ // end pre-warming
'Loading...',
]);
expect(ReactNoop).toMatchRenderedOutput(null);
@@ -765,14 +766,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// The async content suspends
'Suspend! [Outer content]',
'Loading outer...',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend! [Outer content]',
- 'Suspend! [Inner content]',
- 'Loading inner...',
- ]
- : []),
+ // pre-warming
+ 'Suspend! [Outer content]',
+ 'Suspend! [Inner content]',
+ 'Loading inner...',
]);
// The outer loading state finishes immediately.
expect(ReactNoop).toMatchRenderedOutput(
@@ -952,10 +949,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -1068,10 +1064,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
ReactNoop.render();
await waitForAll([
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]', 'Suspend! [C]']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
+ 'Suspend! [C]',
]);
expect(ReactNoop).toMatchRenderedOutput('Loading...');
@@ -1735,10 +1731,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// A suspends
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]', 'Loading more...']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
+ 'Loading more...',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -1753,8 +1749,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// B suspends
'Suspend! [B]',
'Loading more...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
// Because we've already been waiting for so long we've exceeded
@@ -1799,10 +1795,10 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// A suspends
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]', 'Loading more...']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
+ 'Loading more...',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -1881,10 +1877,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Loading A...',
'Suspend! [B]',
'Loading B...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
]);
expect(ReactNoop).toMatchRenderedOutput(
<>
@@ -2035,8 +2030,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
assertLog([
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput('Loading...');
@@ -2046,10 +2041,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
assertLog([
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [A]', 'Suspend! [B]']
- : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'Suspend! [B]',
]);
});
@@ -2108,8 +2102,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
assertLog([
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
await resolveText('A');
@@ -2138,8 +2132,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
assertLog([
'Suspend! [A]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
await resolveText('A');
@@ -2168,8 +2162,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Foo',
'Suspend! [A]',
'Initial load...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]', 'B'] : []),
+ // pre-warming
+ 'Suspend! [A]',
+ 'B',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -2191,8 +2186,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Suspend! [C]',
'Updating...',
'B',
-
- ...(gate('enableSiblingPrerendering') ? ['A', 'Suspend! [C]'] : []),
+ // pre-warming
+ 'A',
+ 'Suspend! [C]',
]);
// Flush to skip suspended time.
Scheduler.unstable_advanceTime(600);
@@ -2240,8 +2236,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Suspend! [A]',
'B',
// null
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
expect(ReactNoop).toMatchRenderedOutput();
@@ -2263,8 +2259,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Suspend! [C]',
// null
'B',
-
- ...(gate('enableSiblingPrerendering') ? ['A', 'Suspend! [C]'] : []),
+ // pre-warming
+ 'A',
+ 'Suspend! [C]',
]);
// Flush to skip suspended time.
Scheduler.unstable_advanceTime(600);
@@ -2312,8 +2309,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'A',
'Suspend! [B]',
'Loading B...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
// Flush to skip suspended time.
Scheduler.unstable_advanceTime(600);
@@ -2394,8 +2391,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'A',
'Suspend! [B]',
// Null
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
// Still suspended.
expect(ReactNoop).toMatchRenderedOutput();
@@ -2424,8 +2421,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// Only a short time is needed to unsuspend the initial loading state.
Scheduler.unstable_advanceTime(400);
@@ -2478,8 +2475,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// Only a short time is needed to unsuspend the initial loading state.
Scheduler.unstable_advanceTime(400);
@@ -2538,8 +2535,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// Only a short time is needed to unsuspend the initial loading state.
Scheduler.unstable_advanceTime(400);
@@ -2587,8 +2584,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// Only a short time is needed to unsuspend the initial loading state.
Scheduler.unstable_advanceTime(400);
@@ -2652,8 +2649,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// Only a short time is needed to unsuspend the initial loading state.
Scheduler.unstable_advanceTime(400);
@@ -2727,8 +2724,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [A]'] : []),
+ // pre-warming
+ 'Suspend! [A]',
]);
// Only a short time is needed to unsuspend the initial loading state.
Scheduler.unstable_advanceTime(400);
@@ -2794,8 +2791,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Hi!',
'Suspend! [A]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Hi!', 'Suspend! [A]'] : []),
+ // pre-warming
+ 'Hi!',
+ 'Suspend! [A]',
]);
await act(() => resolveText('A'));
assertLog(['Hi!', 'A']);
@@ -3117,73 +3115,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
},
);
- // TODO: This test is substantially different when sibling prerendering is
- // enabled because we never work on Idle updates if there are pending retries.
- // This was already an issue before the enableSiblingPrerendering change but
- // it's exacerbated by the fact that we schedule a retry immediately. I'm not
- // going to bother to update this test for now, though, because Idle updates
- // aren't actually used and should probably just be deleted unless/until we
- // finish the feature. Feel free to delete if needed.
- // @gate !enableSiblingPrerendering
- // @gate enableLegacyCache
- it(
- 'multiple updates originating inside a Suspense boundary at different ' +
- 'priority levels are not dropped, including Idle updates',
- async () => {
- const {useState} = React;
- const root = ReactNoop.createRoot();
-
- function Parent() {
- return (
- <>
- }>
-
-
- >
- );
- }
-
- let setText;
- function Child() {
- const [text, _setText] = useState('A');
- setText = _setText;
- return ;
- }
-
- await seedNextTextCache('A');
- await act(() => {
- root.render();
- });
- assertLog(['A']);
- expect(root).toMatchRenderedOutput();
-
- await act(async () => {
- // Schedule two updates that originate inside the Suspense boundary.
- // The first one causes the boundary to suspend. The second one is at
- // lower priority and unsuspends it by hiding the async component.
- setText('B');
-
- await resolveText('C');
- ReactNoop.idleUpdates(() => {
- setText('C');
- });
-
- // First we attempt the high pri update. It suspends.
- await waitForPaint(['Suspend! [B]', 'Loading...']);
- expect(root).toMatchRenderedOutput(
- <>
-
-
- >,
- );
-
- // Now flush the remaining work. The Idle update successfully finishes.
- await waitForAll(['C']);
- expect(root).toMatchRenderedOutput();
- });
- },
- );
-
// @gate enableLegacyCache
it(
'fallback component can update itself even after a high pri update to ' +
@@ -3226,8 +3157,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await waitForAll([
'Suspend! [B]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [B]'] : []),
+ // pre-warming
+ 'Suspend! [B]',
]);
});
@@ -3264,8 +3195,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// Then complete the update to the fallback.
'Still loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [C]'] : []),
+ 'Suspend! [C]',
]);
expect(root).toMatchRenderedOutput(
<>
@@ -3326,12 +3256,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
await act(() => {
setText('C');
});
- assertLog([
- 'Suspend! [C]',
- 'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [C]'] : []),
- ]);
+ assertLog(['Suspend! [C]', 'Loading...', 'Suspend! [C]']);
// Commit. This will insert a fragment fiber to wrap around the component
// that triggered the update.
@@ -3411,8 +3336,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
assertLog([
'Suspend! [C]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [C]'] : []),
+ // pre-warming
+ 'Suspend! [C]',
]);
// Commit. This will insert a fragment fiber to wrap around the component
@@ -3444,9 +3369,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// be able to finish rendering.
assertLog([
'Suspend! [D]',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [D]'] : []),
-
+ // pre-warming
+ 'Suspend! [D]',
+ // end pre-warming
'E',
]);
expect(root).toMatchRenderedOutput();
@@ -3534,10 +3459,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Outer step: 0',
'Suspend! [Inner text: B]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [Inner text: B]', 'Inner step: 0']
- : []),
+ // pre-warming
+ 'Suspend! [Inner text: B]',
+ 'Inner step: 0',
]);
// Commit the placeholder
await advanceTimers(250);
@@ -3566,10 +3490,9 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Outer step: 1',
'Suspend! [Inner text: B]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [Inner text: B]', 'Inner step: 1']
- : []),
+ // pre-warming
+ 'Suspend! [Inner text: B]',
+ 'Inner step: 1',
]);
expect(root).toMatchRenderedOutput(
<>
@@ -3664,8 +3587,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'Outer: B0',
'Suspend! [Inner: B0]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Inner: B0]'] : []),
+ // pre-warming
+ 'Suspend! [Inner: B0]',
]);
// Commit the placeholder
await advanceTimers(250);
@@ -3907,77 +3830,6 @@ describe('ReactSuspenseWithNoopRenderer', () => {
});
});
- // TODO: This test is substantially different when sibling prerendering is
- // enabled because we never work on Idle updates if there are pending retries.
- // This was already an issue before the enableSiblingPrerendering change but
- // it's exacerbated by the fact that we schedule a retry immediately. I'm not
- // going to bother to update this test for now, though, because Idle updates
- // aren't actually used and should probably just be deleted unless/until we
- // finish the feature. Feel free to delete if needed.
- // @gate !enableSiblingPrerendering
- // @gate enableLegacyCache
- it('regression related to Idle updates (outdated experiment): #18657', async () => {
- const {useState} = React;
-
- let setText;
- function App() {
- const [text, _setText] = useState('A');
- setText = _setText;
- return ;
- }
-
- const root = ReactNoop.createRoot();
- await act(async () => {
- await seedNextTextCache('A');
- root.render(
- }>
-
- ,
- );
- });
- assertLog(['A']);
- expect(root).toMatchRenderedOutput();
-
- await act(async () => {
- setText('B');
- ReactNoop.idleUpdates(() => {
- setText('C');
- });
-
- // Suspend the first update. This triggers an immediate fallback because
- // it wasn't wrapped in startTransition.
- await waitForPaint(['Suspend! [B]', 'Loading...']);
- expect(root).toMatchRenderedOutput(
- <>
-
-
- >,
- );
-
- // Once the fallback renders, proceed to the Idle update. This will
- // also suspend.
- await waitForAll(['Suspend! [C]']);
- });
-
- // Finish loading B.
- await act(async () => {
- setText('B');
- await resolveText('B');
- });
- // We did not try to render the Idle update again because there have been no
- // additional updates since the last time it was attempted.
- assertLog(['B']);
- expect(root).toMatchRenderedOutput();
-
- // Finish loading C.
- await act(async () => {
- setText('C');
- await resolveText('C');
- });
- assertLog(['C']);
- expect(root).toMatchRenderedOutput();
- });
-
// @gate enableLegacyCache
it('retries have lower priority than normal updates', async () => {
const {useState} = React;
@@ -4004,8 +3856,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'A',
'Suspend! [Async]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Async]'] : []),
+ // pre-warming
+ 'Suspend! [Async]',
]);
expect(root).toMatchRenderedOutput(
<>
@@ -4076,8 +3928,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
assertLog([
'Suspend! [Async]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend! [Async]'] : []),
+ // pre-warming
+ 'Suspend! [Async]',
]);
expect(root).toMatchRenderedOutput(
<>
@@ -4248,10 +4100,11 @@ describe('ReactSuspenseWithNoopRenderer', () => {
'1',
'Suspend! [Async]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend! [Async]', 'A', 'B', 'C']
- : []),
+ // pre-warming
+ 'Suspend! [Async]',
+ 'A',
+ 'B',
+ 'C',
]);
expect(root).toMatchRenderedOutput(
<>
diff --git a/packages/react-reconciler/src/__tests__/ReactTransition-test.js b/packages/react-reconciler/src/__tests__/ReactTransition-test.js
index 60456ee6392d2..d3ad2e613857e 100644
--- a/packages/react-reconciler/src/__tests__/ReactTransition-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactTransition-test.js
@@ -860,9 +860,9 @@ describe('ReactTransition', () => {
assertLog([
// Suspend.
'Suspend! [Async]',
-
- ...(gate('enableSiblingPrerendering') ? ['Normal pri: 0'] : []),
-
+ // pre-warming
+ 'Normal pri: 0',
+ // end pre-warming
'Loading...',
]);
expect(root).toMatchRenderedOutput('(empty), Normal pri: 0');
diff --git a/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js b/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js
index 772eb987100aa..ab4982ce020d3 100644
--- a/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js
@@ -442,7 +442,9 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Page Two]'] : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(page transition, 1000)',
'onTransitionProgress(page transition, 1000, 2000, [suspense page])',
]);
@@ -533,7 +535,9 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Page Two]'] : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(page transition, 1000)',
'onTransitionProgress(page transition, 1000, 1000, [suspense page])',
]);
@@ -552,7 +556,9 @@ describe('ReactInteractionTracing', () => {
'Suspend [Show Text]',
'Show Text Loading...',
'Page Two',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Show Text]'] : []),
+ // pre-warming
+ 'Suspend [Show Text]',
+ // end pre-warming
'onTransitionStart(text transition, 2000)',
'onTransitionProgress(text transition, 2000, 2000, [show text])',
]);
@@ -642,7 +648,9 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Page Two]'] : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(page transition, 1000)',
'onTransitionProgress(page transition, 1000, 2000, [suspense page])',
]);
@@ -656,9 +664,10 @@ describe('ReactInteractionTracing', () => {
'Show Text Loading...',
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Show Text]', 'Suspend [Page Two]']
- : []),
+ // pre-warming
+ 'Suspend [Show Text]',
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(show text, 2000)',
'onTransitionProgress(show text, 2000, 2000, [show text])',
]);
@@ -761,15 +770,13 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend [Page Two]',
- 'Suspend [Show Text One]',
- 'Show Text One Loading...',
- 'Suspend [Show Text Two]',
- 'Show Text Two Loading...',
- ]
- : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ 'Suspend [Show Text One]',
+ 'Show Text One Loading...',
+ 'Suspend [Show Text Two]',
+ 'Show Text Two Loading...',
+ // end pre-warming
'onTransitionStart(page transition, 1000)',
'onTransitionProgress(page transition, 1000, 2000, [suspense page])',
]);
@@ -784,9 +791,10 @@ describe('ReactInteractionTracing', () => {
'Show Text One Loading...',
'Suspend [Show Text Two]',
'Show Text Two Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Show Text One]', 'Suspend [Show Text Two]']
- : []),
+ // pre-warming
+ 'Suspend [Show Text One]',
+ 'Suspend [Show Text Two]',
+ // end pre-warming
'onTransitionProgress(page transition, 1000, 3000, [show text one, show text two])',
]);
@@ -899,15 +907,13 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend [Page Two]',
- 'Suspend [Show Text One]',
- 'Show Text One Loading...',
- 'Suspend [Show Text]',
- 'Show Text Loading...',
- ]
- : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ 'Suspend [Show Text One]',
+ 'Show Text One Loading...',
+ 'Suspend [Show Text]',
+ 'Show Text Loading...',
+ // end pre-warming
'onTransitionStart(navigate, 1000)',
'onTransitionStart(show text one, 1000)',
'onTransitionProgress(navigate, 1000, 2000, [suspense page])',
@@ -923,9 +929,10 @@ describe('ReactInteractionTracing', () => {
'Show Text One Loading...',
'Suspend [Show Text]',
'Show Text Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Show Text One]', 'Suspend [Show Text]']
- : []),
+ // pre-warming
+ 'Suspend [Show Text One]',
+ 'Suspend [Show Text]',
+ // end pre-warming
'onTransitionProgress(navigate, 1000, 3000, [show text one, ])',
'onTransitionProgress(show text one, 1000, 3000, [show text one, ])',
]);
@@ -942,13 +949,11 @@ describe('ReactInteractionTracing', () => {
'Show Text Loading...',
'Suspend [Show Text Two]',
'Show Text Two Loading...',
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend [Show Text One]',
- 'Suspend [Show Text]',
- 'Suspend [Show Text Two]',
- ]
- : []),
+ // pre-warming
+ 'Suspend [Show Text One]',
+ 'Suspend [Show Text]',
+ 'Suspend [Show Text Two]',
+ // end pre-warming
'onTransitionStart(show text two, 3000)',
'onTransitionProgress(show text two, 3000, 4000, [show text two])',
]);
@@ -1153,9 +1158,11 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Page Two]', 'Suspend [Marker Text]', 'Loading...']
- : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ 'Suspend [Marker Text]',
+ 'Loading...',
+ // end pre-warming
'onTransitionStart(page transition, 1000)',
]);
@@ -1167,7 +1174,9 @@ describe('ReactInteractionTracing', () => {
'Page Two',
'Suspend [Marker Text]',
'Loading...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Marker Text]'] : []),
+ // pre-warming
+ 'Suspend [Marker Text]',
+ // end pre-warming
'onMarkerProgress(page transition, async marker, 1000, 3000, [marker suspense])',
'onMarkerComplete(page transition, sync marker, 1000, 3000)',
]);
@@ -1271,15 +1280,13 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Outer Text]',
'Outer...',
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend [Outer Text]',
- 'Suspend [Inner Text One]',
- 'Inner One...',
- 'Suspend [Inner Text Two]',
- 'Inner Two...',
- ]
- : []),
+ // pre-warming
+ 'Suspend [Outer Text]',
+ 'Suspend [Inner Text One]',
+ 'Inner One...',
+ 'Suspend [Inner Text Two]',
+ 'Inner Two...',
+ // end pre-warming
'onTransitionStart(page transition, 1000)',
'onMarkerProgress(page transition, outer marker, 1000, 2000, [outer])',
]);
@@ -1297,9 +1304,9 @@ describe('ReactInteractionTracing', () => {
'Suspend [Inner Text One]',
'Inner One...',
'Inner Text Two',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Inner Text One]']
- : []),
+ // pre-warming
+ 'Suspend [Inner Text One]',
+ // end pre-warming
'onMarkerProgress(page transition, outer marker, 1000, 4000, [inner one])',
'onMarkerComplete(page transition, marker two, 1000, 4000)',
]);
@@ -1535,9 +1542,10 @@ describe('ReactInteractionTracing', () => {
'Loading...',
'Suspend [Sibling Text]',
'Sibling Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Page Two]', 'Suspend [Sibling Text]']
- : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ 'Suspend [Sibling Text]',
+ // end pre-warming
'onTransitionStart(transition one, 1000)',
'onMarkerProgress(transition one, parent, 1000, 2000, [suspense page, suspense sibling])',
'onMarkerProgress(transition one, marker one, 1000, 2000, [suspense page])',
@@ -1553,9 +1561,10 @@ describe('ReactInteractionTracing', () => {
'Loading...',
'Suspend [Sibling Text]',
'Sibling Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Page Two]', 'Suspend [Sibling Text]']
- : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ 'Suspend [Sibling Text]',
+ // end pre-warming
'onMarkerProgress(transition one, parent, 1000, 3000, [suspense sibling])',
'onMarkerIncomplete(transition one, marker one, 1000, [{endTime: 3000, name: marker one, type: marker}, {endTime: 3000, name: suspense page, type: suspense}])',
'onMarkerIncomplete(transition one, parent, 1000, [{endTime: 3000, name: marker one, type: marker}, {endTime: 3000, name: suspense page, type: suspense}])',
@@ -1569,9 +1578,9 @@ describe('ReactInteractionTracing', () => {
'Loading...',
'Suspend [Sibling Text]',
'Sibling Loading...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Page Two]', 'Suspend [Sibling Text]']
- : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ 'Suspend [Sibling Text]',
]);
});
@@ -1693,9 +1702,10 @@ describe('ReactInteractionTracing', () => {
'Loading One...',
'Suspend [Page Two]',
'Loading Two...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Page One]', 'Suspend [Page Two]']
- : []),
+ // pre-warming
+ 'Suspend [Page One]',
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(transition, 1000)',
'onMarkerProgress(transition, parent, 1000, 2000, [suspense one, suspense two])',
'onMarkerProgress(transition, one, 1000, 2000, [suspense one])',
@@ -1709,7 +1719,9 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading Two...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Page Two]'] : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ // end pre-warming
'onMarkerProgress(transition, parent, 1000, 3000, [suspense two])',
'onMarkerIncomplete(transition, one, 1000, [{endTime: 3000, name: one, type: marker}, {endTime: 3000, name: suspense one, type: suspense}])',
'onMarkerIncomplete(transition, parent, 1000, [{endTime: 3000, name: one, type: marker}, {endTime: 3000, name: suspense one, type: suspense}])',
@@ -1836,14 +1848,12 @@ describe('ReactInteractionTracing', () => {
'Loading One...',
'Suspend [Page Two]',
'Loading Two...',
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend [Page One]',
- 'Suspend [Child]',
- 'Loading Child...',
- 'Suspend [Page Two]',
- ]
- : []),
+ // pre-warming
+ 'Suspend [Page One]',
+ 'Suspend [Child]',
+ 'Loading Child...',
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(transition, 1000)',
'onMarkerProgress(transition, parent, 1000, 2000, [suspense one, suspense two])',
'onMarkerProgress(transition, one, 1000, 2000, [suspense one])',
@@ -1858,7 +1868,9 @@ describe('ReactInteractionTracing', () => {
'Page One',
'Suspend [Child]',
'Loading Child...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Child]'] : []),
+ // pre-warming
+ 'Suspend [Child]',
+ // end pre-warming
'onMarkerProgress(transition, parent, 1000, 3000, [suspense two, suspense child])',
'onMarkerProgress(transition, one, 1000, 3000, [suspense child])',
'onMarkerComplete(transition, page one, 1000, 3000)',
@@ -1871,7 +1883,10 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Page Two]',
'Loading Two...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Page Two]'] : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ // end pre-warming
+
// "suspense one" has unsuspended so shouldn't be included
// tracing marker "page one" has completed so shouldn't be included
// all children of "suspense child" haven't yet been rendered so shouldn't be included
@@ -1969,7 +1984,9 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Child]',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Child]'] : []),
+ // pre-warming
+ 'Suspend [Child]',
+ // end pre-warming
'onTransitionStart(transition, 0)',
'onMarkerProgress(transition, parent, 0, 1000, [child])',
'onTransitionProgress(transition, 0, 1000, [child])',
@@ -1983,9 +2000,9 @@ describe('ReactInteractionTracing', () => {
await waitForAll([
'Suspend [Appended child]',
'Suspend [Child]',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Appended child]', 'Suspend [Child]']
- : []),
+ // pre-warming
+ 'Suspend [Appended child]',
+ 'Suspend [Child]',
]);
// This deleted child isn't part of the transition so we
@@ -1995,7 +2012,8 @@ describe('ReactInteractionTracing', () => {
await advanceTimers(1000);
await waitForAll([
'Suspend [Child]',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Child]'] : []),
+ // pre-warming
+ 'Suspend [Child]',
]);
await resolveText('Child');
@@ -2097,7 +2115,9 @@ describe('ReactInteractionTracing', () => {
assertLog([
'Suspend [Child]',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Child]'] : []),
+ // pre-warming
+ 'Suspend [Child]',
+ // end pre-warming
'onTransitionStart(transition one, 0)',
'onMarkerProgress(transition one, parent, 0, 1000, [child])',
'onTransitionProgress(transition one, 0, 1000, [child])',
@@ -2118,9 +2138,10 @@ describe('ReactInteractionTracing', () => {
assertLog([
'Suspend [Appended child]',
'Suspend [Child]',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Appended child]', 'Suspend [Child]']
- : []),
+ // pre-warming
+ 'Suspend [Appended child]',
+ 'Suspend [Child]',
+ // end pre-warming
'onTransitionStart(transition two, 1000)',
'onMarkerProgress(transition two, appended child, 1000, 2000, [appended child])',
'onTransitionProgress(transition two, 1000, 2000, [appended child])',
@@ -2134,7 +2155,9 @@ describe('ReactInteractionTracing', () => {
assertLog([
'Suspend [Child]',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Child]'] : []),
+ // pre-warming
+ 'Suspend [Child]',
+ // end pre-warming
'onMarkerProgress(transition two, appended child, 1000, 3000, [])',
'onMarkerIncomplete(transition two, appended child, 1000, [{endTime: 3000, name: appended child, type: suspense}])',
]);
@@ -2291,20 +2314,11 @@ describe('ReactInteractionTracing', () => {
assertLog([
'Suspend [Text]',
'Loading...',
-
- ...(gate('enableSiblingPrerendering')
- ? [
- 'Suspend [Text]',
- 'onTransitionStart(transition, 0)',
-
- 'Suspend [Hidden Text]',
- 'Hidden Loading...',
- ]
- : [
- 'Suspend [Hidden Text]',
- 'Hidden Loading...',
- 'onTransitionStart(transition, 0)',
- ]),
+ // pre-warming
+ 'Suspend [Text]',
+ 'onTransitionStart(transition, 0)',
+ 'Suspend [Hidden Text]',
+ 'Hidden Loading...',
]);
await act(() => {
@@ -2368,7 +2382,9 @@ describe('ReactInteractionTracing', () => {
assertLog([
'Suspend [Page Two]',
'Loading...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Page Two]'] : []),
+ // pre-warming
+ 'Suspend [Page Two]',
+ // end pre-warming
'onTransitionStart(page transition, 0)',
'onTransitionProgress(page transition, 0, 1000, [suspense page])',
]);
@@ -2440,10 +2456,13 @@ describe('ReactInteractionTracing', () => {
'Text',
'Suspend [Text Two]',
'Loading Two...',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Text Two]'] : []),
+ // pre-warming
+ 'Suspend [Text Two]',
+ // end pre-warming
'onTransitionStart(transition, 0)',
'onTransitionProgress(transition, 0, 1000, [two])',
- ...(gate('enableSiblingPrerendering') ? ['Suspend [Text Two]'] : []),
+ // pre-warming
+ 'Suspend [Text Two]',
]);
await act(() => {
@@ -2515,9 +2534,10 @@ describe('ReactInteractionTracing', () => {
'Loading one...',
'Suspend [Text two]',
'Loading two...',
- ...(gate('enableSiblingPrerendering')
- ? ['Suspend [Text one]', 'Suspend [Text two]']
- : []),
+ // pre-warming
+ 'Suspend [Text one]',
+ 'Suspend [Text two]',
+ // end pre-warming
'onTransitionStart(transition one, 0) /root one/',
'onTransitionProgress(transition one, 0, 1000, [one]) /root one/',
'onTransitionStart(transition two, 0) /root two/',
diff --git a/packages/react-reconciler/src/__tests__/ReactUse-test.js b/packages/react-reconciler/src/__tests__/ReactUse-test.js
index de0773076c4b5..9714cb4a3e2e6 100644
--- a/packages/react-reconciler/src/__tests__/ReactUse-test.js
+++ b/packages/react-reconciler/src/__tests__/ReactUse-test.js
@@ -196,8 +196,8 @@ describe('ReactUse', () => {
assertLog([
'Suspend!',
'Loading...',
-
- ...(gate('enableSiblingPrerendering') ? ['Suspend!'] : []),
+ // pre-warming
+ 'Suspend!',
]);
expect(root).toMatchRenderedOutput('Loading...');
});
@@ -1123,10 +1123,9 @@ describe('ReactUse', () => {
});
assertLog([
'(Loading A...)',
-
- ...(gate('enableSiblingPrerendering')
- ? ['(Loading C...)', '(Loading B...)']
- : []),
+ // pre-warming
+ '(Loading C...)',
+ '(Loading B...)',
]);
expect(root).toMatchRenderedOutput('(Loading A...)');
@@ -2051,16 +2050,12 @@ describe('ReactUse', () => {
assertLog(['Async text requested [World]']);
await act(() => resolveTextRequests('World'));
- assertConsoleErrorDev(
- gate('enableSiblingPrerendering')
- ? [
- 'A component was suspended by an uncached promise. ' +
- 'Creating promises inside a Client Component or hook is not yet supported, ' +
- 'except via a Suspense-compatible library or framework.\n' +
- ' in App (at **)',
- ]
- : [],
- );
+ assertConsoleErrorDev([
+ 'A component was suspended by an uncached promise. ' +
+ 'Creating promises inside a Client Component or hook is not yet supported, ' +
+ 'except via a Suspense-compatible library or framework.\n' +
+ ' in App (at **)',
+ ]);
assertLog(['Hi', 'World']);
expect(root).toMatchRenderedOutput('Hi World');
@@ -2107,17 +2102,13 @@ describe('ReactUse', () => {
assertLog(['Async text requested [World]']);
await act(() => resolveTextRequests('World'));
- assertConsoleErrorDev(
- gate('enableSiblingPrerendering')
- ? [
- 'A component was suspended by an uncached promise. ' +
- 'Creating promises inside a Client Component or hook is not yet supported, ' +
- 'except via a Suspense-compatible library or framework.\n' +
- ' in div (at **)\n' +
- ' in App (at **)',
- ]
- : [],
- );
+ assertConsoleErrorDev([
+ 'A component was suspended by an uncached promise. ' +
+ 'Creating promises inside a Client Component or hook is not yet supported, ' +
+ 'except via a Suspense-compatible library or framework.\n' +
+ ' in div (at **)\n' +
+ ' in App (at **)',
+ ]);
assertLog(['Hi', 'World']);
expect(root).toMatchRenderedOutput(Hi World
);
diff --git a/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js b/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js
index 0c7e75c39a4a5..0d0287bca612d 100644
--- a/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js
+++ b/packages/react-reconciler/src/__tests__/StrictEffectsMode-test.js
@@ -907,10 +907,9 @@ describe('StrictEffectsMode', () => {
'Child suspended',
'Fallback',
'Fallback',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Child rendered', 'Child suspended']
- : []),
+ // pre-warming
+ 'Child rendered',
+ 'Child suspended',
]);
log = [];
@@ -932,10 +931,9 @@ describe('StrictEffectsMode', () => {
'Fallback',
'Parent dep destroy',
'Parent dep create',
-
- ...(gate('enableSiblingPrerendering')
- ? ['Child rendered', 'Child suspended']
- : []),
+ // pre-warming
+ 'Child rendered',
+ 'Child suspended',
]);
log = [];
diff --git a/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js b/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
index a5c6a6995d718..eb5bc6ed98cd8 100644
--- a/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
+++ b/packages/react-reconciler/src/__tests__/useSyncExternalStore-test.js
@@ -333,8 +333,8 @@ describe('useSyncExternalStore', () => {
// This should a synchronous re-render of A using the updated value. In
// this test, this causes A to suspend.
'Suspend A',
-
- ...(gate('enableSiblingPrerendering') ? ['B: Updated'] : []),
+ // pre-warming
+ 'B: Updated',
]);
// Nothing has committed, because A suspended and no fallback
// was provided.
@@ -419,7 +419,9 @@ describe('useSyncExternalStore', () => {
await act(async () => {
root.render();
});
- assertLog([...(gate('enableSiblingPrerendering') ? ['(not set)'] : [])]);
+
+ // pre-warming
+ assertLog(['(not set)']);
expect(root).toMatchRenderedOutput('Loading...');
@@ -429,11 +431,12 @@ describe('useSyncExternalStore', () => {
resolveText('A');
});
assertLog([
- ...(gate('enableSiblingPrerendering')
- ? ['A', 'B', 'A', 'B', 'B']
- : gate(flags => flags.alwaysThrottleRetries)
- ? ['A', '(not set)', 'A', '(not set)', 'B']
- : ['A', '(not set)', 'A', '(not set)', '(not set)', 'B']),
+ 'A',
+ 'B',
+ 'A',
+ 'B',
+ 'B',
+ ...(gate('alwaysThrottleRetries') ? [] : ['B']),
]);
expect(root).toMatchRenderedOutput('AB');
diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js
index 4ad33f9cea3f0..119c2a0778fc6 100644
--- a/packages/react-server/src/ReactFizzHooks.js
+++ b/packages/react-server/src/ReactFizzHooks.js
@@ -47,6 +47,8 @@ import {
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
import {getFormState} from './ReactFizzServer';
+import noop from 'shared/noop';
+
type BasicStateAction = (S => S) | S;
type Dispatch = A => void;
@@ -795,8 +797,6 @@ function useMemoCache(size: number): Array {
return data;
}
-function noop(): void {}
-
function clientHookNotSupported() {
throw new Error(
'Cannot use state or effect Hooks in renderToHTML because ' +
diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js
index 47f67d1eb46f1..f86dc8c9ce020 100644
--- a/packages/react-server/src/ReactFizzServer.js
+++ b/packages/react-server/src/ReactFizzServer.js
@@ -176,6 +176,7 @@ import {
} from 'shared/ReactFeatureFlags';
import assign from 'shared/assign';
+import noop from 'shared/noop';
import getComponentNameFromType from 'shared/getComponentNameFromType';
import isArray from 'shared/isArray';
import {SuspenseException, getSuspendedThenable} from './ReactFizzThenable';
@@ -425,8 +426,6 @@ function defaultErrorHandler(error: mixed) {
return null;
}
-function noop(): void {}
-
function RequestInstance(
this: $FlowFixMe,
resumableState: ResumableState,
diff --git a/packages/react-server/src/ReactFizzThenable.js b/packages/react-server/src/ReactFizzThenable.js
index f686b63d44db9..cb0ccfac69928 100644
--- a/packages/react-server/src/ReactFizzThenable.js
+++ b/packages/react-server/src/ReactFizzThenable.js
@@ -20,6 +20,8 @@ import type {
RejectedThenable,
} from 'shared/ReactTypes';
+import noop from 'shared/noop';
+
export opaque type ThenableState = Array>;
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
@@ -40,8 +42,6 @@ export function createThenableState(): ThenableState {
return [];
}
-function noop(): void {}
-
export function trackUsedThenable(
thenableState: ThenableState,
thenable: Thenable,
diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js
index ed6d9c443b7bc..4048a855ef181 100644
--- a/packages/react-server/src/ReactFlightServer.js
+++ b/packages/react-server/src/ReactFlightServer.js
@@ -105,6 +105,8 @@ import {resolveOwner, setCurrentOwner} from './flight/ReactFlightCurrentOwner';
import {getOwnerStackByComponentInfoInDev} from 'shared/ReactComponentInfoStack';
import {resetOwnerStackLimit} from 'shared/ReactOwnerStackReset';
+import noop from 'shared/noop';
+
import {
callComponentInDEV,
callLazyInitInDEV,
@@ -443,9 +445,7 @@ function defaultErrorHandler(error: mixed) {
// Don't transform to our wrapper
}
-function defaultPostponeHandler(reason: string) {
- // Noop
-}
+const defaultPostponeHandler: (reason: string) => void = noop;
function RequestInstance(
this: $FlowFixMe,
@@ -558,8 +558,6 @@ function RequestInstance(
pingedTasks.push(rootTask);
}
-function noop() {}
-
export function createRequest(
model: ReactClientValue,
bundlerConfig: ClientManifest,
diff --git a/packages/react-server/src/ReactFlightThenable.js b/packages/react-server/src/ReactFlightThenable.js
index 89912a7dd5d20..47e7b914da176 100644
--- a/packages/react-server/src/ReactFlightThenable.js
+++ b/packages/react-server/src/ReactFlightThenable.js
@@ -20,6 +20,8 @@ import type {
RejectedThenable,
} from 'shared/ReactTypes';
+import noop from 'shared/noop';
+
export opaque type ThenableState = Array>;
// An error that is thrown (e.g. by `use`) to trigger Suspense. If we
@@ -40,8 +42,6 @@ export function createThenableState(): ThenableState {
return [];
}
-function noop(): void {}
-
export function trackUsedThenable(
thenableState: ThenableState,
thenable: Thenable,
diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js
index 7d0561790b33f..dd5b4e8c97247 100644
--- a/packages/react-test-renderer/src/ReactTestRenderer.js
+++ b/packages/react-test-renderer/src/ReactTestRenderer.js
@@ -60,6 +60,10 @@ import {
disableLegacyMode,
} from 'shared/ReactFeatureFlags';
+import noop from 'shared/noop';
+
+const defaultOnDefaultTransitionIndicator: () => void | (() => void) = noop;
+
// $FlowFixMe[prop-missing]: This is only in the development export.
const act = React.act;
@@ -515,6 +519,7 @@ function create(
defaultOnUncaughtError,
defaultOnCaughtError,
defaultOnRecoverableError,
+ defaultOnDefaultTransitionIndicator,
null,
);
diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
index 551c10fb5f3df..62bef5353eaba 100644
--- a/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
+++ b/packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
@@ -98,6 +98,7 @@ describe('ReactTestRenderer', () => {
expect.anything(),
expect.anything(),
expect.anything(),
+ expect.anything(),
null,
);
}
diff --git a/packages/react/src/ReactChildren.js b/packages/react/src/ReactChildren.js
index 8fcc83dea4b17..9b474ac832f2b 100644
--- a/packages/react/src/ReactChildren.js
+++ b/packages/react/src/ReactChildren.js
@@ -16,6 +16,7 @@ import type {
} from 'shared/ReactTypes';
import isArray from 'shared/isArray';
+import noop from 'shared/noop';
import {
getIteratorFn,
REACT_ELEMENT_TYPE,
@@ -82,8 +83,6 @@ function getElementKey(element: any, index: number): string {
return index.toString(36);
}
-function noop() {}
-
function resolveThenable(thenable: Thenable): T {
switch (thenable.status) {
case 'fulfilled': {
diff --git a/packages/react/src/ReactStartTransition.js b/packages/react/src/ReactStartTransition.js
index 71efa5d1c253a..3e353a3b61536 100644
--- a/packages/react/src/ReactStartTransition.js
+++ b/packages/react/src/ReactStartTransition.js
@@ -25,6 +25,8 @@ import {
import reportGlobalError from 'shared/reportGlobalError';
+import noop from 'shared/noop';
+
export type Transition = {
types: null | TransitionTypes, // enableViewTransition
gesture: null | GestureProvider, // enableGestureTransition
@@ -177,9 +179,7 @@ export function startGestureTransition(
} finally {
ReactSharedInternals.T = prevTransition;
}
- return function cancelGesture() {
- // Noop
- };
+ return noop;
}
function warnAboutTransitionSubscriptions(
@@ -200,5 +200,3 @@ function warnAboutTransitionSubscriptions(
}
}
}
-
-function noop() {}
diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js
index 9b0e0354e7ecb..217b095a29aa2 100644
--- a/packages/shared/ReactFeatureFlags.js
+++ b/packages/shared/ReactFeatureFlags.js
@@ -102,6 +102,8 @@ export const enableSrcObject = __EXPERIMENTAL__;
export const enableHydrationChangeEvent = __EXPERIMENTAL__;
+export const enableDefaultTransitionIndicator = __EXPERIMENTAL__;
+
/**
* Switches Fiber creation to a simple object instead of a constructor.
*/
@@ -139,8 +141,6 @@ export const enablePersistedModeClonedFlag = false;
export const enableShallowPropDiffing = false;
-export const enableSiblingPrerendering = true;
-
/**
* Enables an expiration time for retry lanes to avoid starvation.
*/
diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js
index c2b56602b39f7..29a49ae366c81 100644
--- a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js
+++ b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js
@@ -23,7 +23,6 @@ export const enableHiddenSubtreeInsertionEffectCleanup = __VARIANT__;
export const enablePersistedModeClonedFlag = __VARIANT__;
export const enableShallowPropDiffing = __VARIANT__;
export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
-export const enableSiblingPrerendering = __VARIANT__;
export const enableFastAddPropertiesInDiffing = __VARIANT__;
export const enableLazyPublicInstanceInFabric = __VARIANT__;
export const renameElementSymbol = __VARIANT__;
diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js
index bb867acdd87fe..8383c0dc351b5 100644
--- a/packages/shared/forks/ReactFeatureFlags.native-fb.js
+++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js
@@ -25,7 +25,6 @@ export const {
enablePersistedModeClonedFlag,
enableShallowPropDiffing,
passChildrenWhenCloningPersistedNodes,
- enableSiblingPrerendering,
enableFastAddPropertiesInDiffing,
enableLazyPublicInstanceInFabric,
renameElementSymbol,
@@ -85,6 +84,7 @@ export const enableScrollEndPolyfill = true;
export const enableSuspenseyImages = false;
export const enableSrcObject = false;
export const enableHydrationChangeEvent = true;
+export const enableDefaultTransitionIndicator = false;
export const ownerStackLimit = 1e4;
// Flow magic to verify the exports of this file match the original version.
diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js
index b783f37d3dce7..acc04dfb055bb 100644
--- a/packages/shared/forks/ReactFeatureFlags.native-oss.js
+++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js
@@ -61,8 +61,6 @@ export const renameElementSymbol = true;
export const retryLaneExpirationMs = 5000;
export const syncLaneExpirationMs = 250;
export const transitionLaneExpirationMs = 5000;
-export const enableSiblingPrerendering = true;
-
export const enableHydrationLaneScheduling = true;
export const enableYieldingBeforePassive = false;
@@ -76,6 +74,7 @@ export const enableScrollEndPolyfill = true;
export const enableSuspenseyImages = false;
export const enableSrcObject = false;
export const enableHydrationChangeEvent = false;
+export const enableDefaultTransitionIndicator = false;
export const ownerStackLimit = 1e4;
export const enableFragmentRefs = false;
diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js
index 5e0e229e03eee..4e51e7260e901 100644
--- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js
+++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js
@@ -62,7 +62,6 @@ export const enableInfiniteRenderLoopDetection = false;
export const renameElementSymbol = true;
export const enableShallowPropDiffing = false;
-export const enableSiblingPrerendering = true;
export const enableYieldingBeforePassive = true;
@@ -75,6 +74,7 @@ export const enableScrollEndPolyfill = true;
export const enableSuspenseyImages = false;
export const enableSrcObject = false;
export const enableHydrationChangeEvent = false;
+export const enableDefaultTransitionIndicator = false;
export const ownerStackLimit = 1e4;
export const enableFragmentRefs = false;
diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
index 6a93f47c688dd..c9bd058f1fef8 100644
--- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
+++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
@@ -60,7 +60,6 @@ export const renameElementSymbol = false;
export const retryLaneExpirationMs = 5000;
export const syncLaneExpirationMs = 250;
export const transitionLaneExpirationMs = 5000;
-export const enableSiblingPrerendering = true;
export const enableHydrationLaneScheduling = true;
export const enableYieldingBeforePassive = false;
export const enableThrottledScheduling = false;
@@ -72,6 +71,7 @@ export const enableScrollEndPolyfill = true;
export const enableSuspenseyImages = false;
export const enableSrcObject = false;
export const enableHydrationChangeEvent = false;
+export const enableDefaultTransitionIndicator = false;
export const enableFragmentRefs = false;
export const ownerStackLimit = 1e4;
diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
index 205baff50b343..baceb1e6b727c 100644
--- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
+++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
@@ -71,7 +71,6 @@ export const renameElementSymbol = false;
export const enableObjectFiber = false;
export const enableShallowPropDiffing = false;
-export const enableSiblingPrerendering = true;
export const enableHydrationLaneScheduling = true;
@@ -86,6 +85,7 @@ export const enableScrollEndPolyfill = true;
export const enableSuspenseyImages = false;
export const enableSrcObject = false;
export const enableHydrationChangeEvent = false;
+export const enableDefaultTransitionIndicator = false;
export const enableFragmentRefs = false;
export const ownerStackLimit = 1e4;
diff --git a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js
index 46442874e7bd1..700aebb1cc42d 100644
--- a/packages/shared/forks/ReactFeatureFlags.www-dynamic.js
+++ b/packages/shared/forks/ReactFeatureFlags.www-dynamic.js
@@ -33,7 +33,6 @@ export const transitionLaneExpirationMs = 5000;
export const enableSchedulingProfiler = __VARIANT__;
export const enableInfiniteRenderLoopDetection = __VARIANT__;
-export const enableSiblingPrerendering = __VARIANT__;
export const enableFastAddPropertiesInDiffing = __VARIANT__;
export const enableLazyPublicInstanceInFabric = false;
diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js
index 7aed5a6ad3c08..5ecd0073edd3f 100644
--- a/packages/shared/forks/ReactFeatureFlags.www.js
+++ b/packages/shared/forks/ReactFeatureFlags.www.js
@@ -26,7 +26,6 @@ export const {
enableObjectFiber,
enableRenderableContext,
enableRetryLaneExpiration,
- enableSiblingPrerendering,
enableTransitionTracing,
enableTrustedTypesIntegration,
favorSafetyOverHydrationPerf,
@@ -115,6 +114,7 @@ export const enableGestureTransition = false;
export const enableSuspenseyImages = false;
export const enableSrcObject = false;
export const enableHydrationChangeEvent = false;
+export const enableDefaultTransitionIndicator = false;
export const ownerStackLimit = 1e4;
diff --git a/packages/shared/noop.js b/packages/shared/noop.js
new file mode 100644
index 0000000000000..0188292909d9e
--- /dev/null
+++ b/packages/shared/noop.js
@@ -0,0 +1,10 @@
+/**
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @flow
+ */
+
+export default function noop() {}
diff --git a/scripts/jest/TestFlags.js b/scripts/jest/TestFlags.js
index f736ca2254f64..12b74039d5379 100644
--- a/scripts/jest/TestFlags.js
+++ b/scripts/jest/TestFlags.js
@@ -87,7 +87,7 @@ function getTestFlags() {
// TODO: Suspending the work loop during the render phase is currently
// not compatible with sibling prerendering. We will add this optimization
// back in a later step.
- enableSuspendingDuringWorkLoop: !featureFlags.enableSiblingPrerendering,
+ enableSuspendingDuringWorkLoop: false,
// This flag is used to determine whether we should run Fizz tests using
// the external runtime or the inline script runtime.