Skip to content

Commit e83bf3f

Browse files
committed
Clean up enableSiblingPrerendering flag
1 parent ff62833 commit e83bf3f

File tree

46 files changed

+511
-1433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+511
-1433
lines changed

packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,7 @@ describe('ReactCache', () => {
123123
const root = ReactNoop.createRoot();
124124
root.render(<App />);
125125

126-
await waitForAll([
127-
'Suspend! [Hi]',
128-
'Loading...',
129-
130-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Hi]'] : []),
131-
]);
126+
await waitForAll(['Suspend! [Hi]', 'Loading...', 'Suspend! [Hi]']);
132127

133128
jest.advanceTimersByTime(100);
134129
assertLog(['Promise resolved [Hi]']);
@@ -147,12 +142,7 @@ describe('ReactCache', () => {
147142
const root = ReactNoop.createRoot();
148143
root.render(<App />);
149144

150-
await waitForAll([
151-
'Suspend! [Hi]',
152-
'Loading...',
153-
154-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Hi]'] : []),
155-
]);
145+
await waitForAll(['Suspend! [Hi]', 'Loading...', 'Suspend! [Hi]']);
156146

157147
textResourceShouldFail = true;
158148
let error;
@@ -192,12 +182,7 @@ describe('ReactCache', () => {
192182
);
193183

194184
if (__DEV__) {
195-
await waitForAll([
196-
'App',
197-
'Loading...',
198-
199-
...(gate('enableSiblingPrerendering') ? ['App'] : []),
200-
]);
185+
await waitForAll(['App', 'Loading...', 'App']);
201186
assertConsoleErrorDev([
202187
'Invalid key type. Expected a string, number, symbol, or ' +
203188
"boolean, but instead received: [ 'Hi', 100 ]\n\n" +
@@ -207,28 +192,17 @@ describe('ReactCache', () => {
207192
(gate(flags => flags.enableOwnerStacks)
208193
? ''
209194
: '\n in Suspense (at **)'),
210-
211-
...(gate('enableSiblingPrerendering')
212-
? [
213-
'Invalid key type. Expected a string, number, symbol, or ' +
214-
"boolean, but instead received: [ 'Hi', 100 ]\n\n" +
215-
'To use non-primitive values as keys, you must pass a hash ' +
216-
'function as the second argument to createResource().\n' +
217-
' in App (at **)',
218-
]
219-
: []),
195+
'Invalid key type. Expected a string, number, symbol, or ' +
196+
"boolean, but instead received: [ 'Hi', 100 ]\n\n" +
197+
'To use non-primitive values as keys, you must pass a hash ' +
198+
'function as the second argument to createResource().\n' +
199+
' in App (at **)',
220200
]);
221201
} else {
222-
await waitForAll([
223-
'App',
224-
'Loading...',
225-
226-
...(gate('enableSiblingPrerendering') ? ['App'] : []),
227-
]);
202+
await waitForAll(['App', 'Loading...', 'App']);
228203
}
229204
});
230205

231-
// @gate enableSiblingPrerendering
232206
it('evicts least recently used values', async () => {
233207
ReactCache.unstable_setGlobalCacheLimit(3);
234208

@@ -379,12 +353,7 @@ describe('ReactCache', () => {
379353
</Suspense>,
380354
);
381355

382-
await waitForAll([
383-
'Suspend! [Hi]',
384-
'Loading...',
385-
386-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Hi]'] : []),
387-
]);
356+
await waitForAll(['Suspend! [Hi]', 'Loading...', 'Suspend! [Hi]']);
388357

389358
resolveThenable('Hi');
390359
// This thenable improperly resolves twice. We should not update the

packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,11 @@ import {
1515
normalizeCodeLocInfo,
1616
} from './utils';
1717

18-
import {ReactVersion} from '../../../../ReactVersions';
19-
import semver from 'semver';
20-
2118
let React = require('react');
2219
let Scheduler;
2320
let store;
2421
let utils;
2522

26-
// TODO: This is how other DevTools tests access the version but we should find
27-
// a better solution for this
28-
const ReactVersionTestingAgainst = process.env.REACT_VERSION || ReactVersion;
29-
// Disabling this while the flag is off in experimental. Leaving the logic so we can
30-
// restore the behavior when we turn the flag back on.
31-
const enableSiblingPrerendering =
32-
false && semver.gte(ReactVersionTestingAgainst, '19.0.0');
33-
3423
// This flag is on experimental which disables timeline profiler.
3524
const enableComponentPerformanceTrack =
3625
React.version.startsWith('19') && React.version.includes('experimental');
@@ -1676,11 +1665,7 @@ describe('Timeline profiler', () => {
16761665
</React.Suspense>,
16771666
);
16781667

1679-
await waitForAll([
1680-
'suspended',
1681-
1682-
...(enableSiblingPrerendering ? ['suspended'] : []),
1683-
]);
1668+
await waitForAll(['suspended', 'suspended']);
16841669

16851670
Scheduler.unstable_advanceTime(10);
16861671
resolveFn();
@@ -1691,8 +1676,7 @@ describe('Timeline profiler', () => {
16911676
const timelineData = stopProfilingAndGetTimelineData();
16921677

16931678
// Verify the Suspense event and duration was recorded.
1694-
if (enableSiblingPrerendering) {
1695-
expect(timelineData.suspenseEvents).toMatchInlineSnapshot(`
1679+
expect(timelineData.suspenseEvents).toMatchInlineSnapshot(`
16961680
[
16971681
{
16981682
"componentName": "Example",
@@ -1720,29 +1704,10 @@ describe('Timeline profiler', () => {
17201704
},
17211705
]
17221706
`);
1723-
} else {
1724-
const suspenseEvent = timelineData.suspenseEvents[0];
1725-
expect(suspenseEvent).toMatchInlineSnapshot(`
1726-
{
1727-
"componentName": "Example",
1728-
"depth": 0,
1729-
"duration": 10,
1730-
"id": "0",
1731-
"phase": "mount",
1732-
"promiseName": "",
1733-
"resolution": "resolved",
1734-
"timestamp": 10,
1735-
"type": "suspense",
1736-
"warning": null,
1737-
}
1738-
`);
1739-
}
17401707

17411708
// There should be two batches of renders: Suspeneded and resolved.
17421709
expect(timelineData.batchUIDToMeasuresMap.size).toBe(2);
1743-
expect(timelineData.componentMeasures).toHaveLength(
1744-
enableSiblingPrerendering ? 3 : 2,
1745-
);
1710+
expect(timelineData.componentMeasures).toHaveLength(3);
17461711
});
17471712

17481713
it('should mark concurrent render with suspense that rejects', async () => {
@@ -1769,11 +1734,7 @@ describe('Timeline profiler', () => {
17691734
</React.Suspense>,
17701735
);
17711736

1772-
await waitForAll([
1773-
'suspended',
1774-
1775-
...(enableSiblingPrerendering ? ['suspended'] : []),
1776-
]);
1737+
await waitForAll(['suspended', 'suspended']);
17771738

17781739
Scheduler.unstable_advanceTime(10);
17791740
rejectFn();
@@ -1784,8 +1745,7 @@ describe('Timeline profiler', () => {
17841745
const timelineData = stopProfilingAndGetTimelineData();
17851746

17861747
// Verify the Suspense event and duration was recorded.
1787-
if (enableSiblingPrerendering) {
1788-
expect(timelineData.suspenseEvents).toMatchInlineSnapshot(`
1748+
expect(timelineData.suspenseEvents).toMatchInlineSnapshot(`
17891749
[
17901750
{
17911751
"componentName": "Example",
@@ -1813,30 +1773,10 @@ describe('Timeline profiler', () => {
18131773
},
18141774
]
18151775
`);
1816-
} else {
1817-
expect(timelineData.suspenseEvents).toHaveLength(1);
1818-
const suspenseEvent = timelineData.suspenseEvents[0];
1819-
expect(suspenseEvent).toMatchInlineSnapshot(`
1820-
{
1821-
"componentName": "Example",
1822-
"depth": 0,
1823-
"duration": 10,
1824-
"id": "0",
1825-
"phase": "mount",
1826-
"promiseName": "",
1827-
"resolution": "rejected",
1828-
"timestamp": 10,
1829-
"type": "suspense",
1830-
"warning": null,
1831-
}
1832-
`);
1833-
}
18341776

18351777
// There should be two batches of renders: Suspeneded and resolved.
18361778
expect(timelineData.batchUIDToMeasuresMap.size).toBe(2);
1837-
expect(timelineData.componentMeasures).toHaveLength(
1838-
enableSiblingPrerendering ? 3 : 2,
1839-
);
1779+
expect(timelineData.componentMeasures).toHaveLength(3);
18401780
});
18411781

18421782
it('should mark cascading class component state updates', async () => {

packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ describe('ReactDOMFiberAsync', () => {
751751
// Because it suspended, it remains on the current path
752752
expect(div.textContent).toBe('/path/a');
753753
});
754-
assertLog(gate('enableSiblingPrerendering') ? ['Suspend! [/path/b]'] : []);
754+
assertLog(['Suspend! [/path/b]']);
755755

756756
await act(async () => {
757757
resolvePromise();

packages/react-dom/src/__tests__/ReactDOMForm-test.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,23 +1436,13 @@ describe('ReactDOMForm', () => {
14361436
</Suspense>,
14371437
),
14381438
);
1439-
assertLog([
1440-
'Suspend! [Count: 0]',
1441-
'Loading...',
1442-
1443-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Count: 0]'] : []),
1444-
]);
1439+
assertLog(['Suspend! [Count: 0]', 'Loading...', 'Suspend! [Count: 0]']);
14451440
await act(() => resolveText('Count: 0'));
14461441
assertLog(['Count: 0']);
14471442

14481443
// Dispatch outside of a transition. This will trigger a loading state.
14491444
await act(() => dispatch());
1450-
assertLog([
1451-
'Suspend! [Count: 1]',
1452-
'Loading...',
1453-
1454-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Count: 1]'] : []),
1455-
]);
1445+
assertLog(['Suspend! [Count: 1]', 'Loading...', 'Suspend! [Count: 1]']);
14561446
expect(container.textContent).toBe('Loading...');
14571447

14581448
await act(() => resolveText('Count: 1'));
@@ -1482,11 +1472,7 @@ describe('ReactDOMForm', () => {
14821472

14831473
const root = ReactDOMClient.createRoot(container);
14841474
await act(() => root.render(<App />));
1485-
assertLog([
1486-
'Suspend! [Count: 0]',
1487-
1488-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Count: 0]'] : []),
1489-
]);
1475+
assertLog(['Suspend! [Count: 0]', 'Suspend! [Count: 0]']);
14901476
await act(() => resolveText('Count: 0'));
14911477
assertLog(['Count: 0']);
14921478

@@ -1501,11 +1487,7 @@ describe('ReactDOMForm', () => {
15011487
{withoutStack: true},
15021488
],
15031489
]);
1504-
assertLog([
1505-
'Suspend! [Count: 1]',
1506-
1507-
...(gate('enableSiblingPrerendering') ? ['Suspend! [Count: 1]'] : []),
1508-
]);
1490+
assertLog(['Suspend! [Count: 1]', 'Suspend! [Count: 1]']);
15091491
expect(container.textContent).toBe('Count: 0');
15101492
});
15111493

packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,7 @@ describe('ReactDOMSuspensePlaceholder', () => {
160160
});
161161

162162
expect(container.textContent).toEqual('Loading...');
163-
assertLog([
164-
'A',
165-
'Suspend! [B]',
166-
'Loading...',
167-
168-
...(gate('enableSiblingPrerendering') ? ['A', 'Suspend! [B]', 'C'] : []),
169-
]);
163+
assertLog(['A', 'Suspend! [B]', 'Loading...', 'A', 'Suspend! [B]', 'C']);
170164
await act(() => {
171165
resolveText('B');
172166
});

packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ test('regression (#20932): return pointer is correct before entering deleted tre
196196
'Suspend! [0]',
197197
'Loading Async...',
198198
'Loading Tail...',
199-
200-
...(gate('enableSiblingPrerendering') ? ['Suspend! [0]'] : []),
199+
'Suspend! [0]',
201200
]);
202201
await act(() => {
203202
resolveText(0);
@@ -211,7 +210,6 @@ test('regression (#20932): return pointer is correct before entering deleted tre
211210
'Loading Async...',
212211
'Suspend! [1]',
213212
'Loading Async...',
214-
215-
...(gate('enableSiblingPrerendering') ? ['Suspend! [1]'] : []),
213+
'Suspend! [1]',
216214
]);
217215
});

packages/react-reconciler/src/ReactFiberCompleteWork.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import {
4141
enableRenderableContext,
4242
passChildrenWhenCloningPersistedNodes,
4343
disableLegacyMode,
44-
enableSiblingPrerendering,
4544
enableViewTransition,
4645
} from 'shared/ReactFeatureFlags';
4746

@@ -625,9 +624,7 @@ function scheduleRetryEffect(
625624

626625
// Track the lanes that have been scheduled for an immediate retry so that
627626
// we can mark them as suspended upon committing the root.
628-
if (enableSiblingPrerendering) {
629-
markSpawnedRetryLane(retryLane);
630-
}
627+
markSpawnedRetryLane(retryLane);
631628
}
632629
}
633630

packages/react-reconciler/src/ReactFiberLane.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
transitionLaneExpirationMs,
2828
retryLaneExpirationMs,
2929
disableLegacyMode,
30-
enableSiblingPrerendering,
3130
} from 'shared/ReactFeatureFlags';
3231
import {isDevToolsPresent} from './ReactFiberDevToolsHook';
3332
import {clz32} from './clz32';
@@ -265,13 +264,11 @@ export function getNextLanes(
265264
if (nonIdlePingedLanes !== NoLanes) {
266265
nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
267266
} else {
268-
if (enableSiblingPrerendering) {
269-
// Nothing has been pinged. Check for lanes that need to be prewarmed.
270-
if (!rootHasPendingCommit) {
271-
const lanesToPrewarm = nonIdlePendingLanes & ~warmLanes;
272-
if (lanesToPrewarm !== NoLanes) {
273-
nextLanes = getHighestPriorityLanes(lanesToPrewarm);
274-
}
267+
// Nothing has been pinged. Check for lanes that need to be prewarmed.
268+
if (!rootHasPendingCommit) {
269+
const lanesToPrewarm = nonIdlePendingLanes & ~warmLanes;
270+
if (lanesToPrewarm !== NoLanes) {
271+
nextLanes = getHighestPriorityLanes(lanesToPrewarm);
275272
}
276273
}
277274
}
@@ -291,13 +288,11 @@ export function getNextLanes(
291288
if (pingedLanes !== NoLanes) {
292289
nextLanes = getHighestPriorityLanes(pingedLanes);
293290
} else {
294-
if (enableSiblingPrerendering) {
295-
// Nothing has been pinged. Check for lanes that need to be prewarmed.
296-
if (!rootHasPendingCommit) {
297-
const lanesToPrewarm = pendingLanes & ~warmLanes;
298-
if (lanesToPrewarm !== NoLanes) {
299-
nextLanes = getHighestPriorityLanes(lanesToPrewarm);
300-
}
291+
// Nothing has been pinged. Check for lanes that need to be prewarmed.
292+
if (!rootHasPendingCommit) {
293+
const lanesToPrewarm = pendingLanes & ~warmLanes;
294+
if (lanesToPrewarm !== NoLanes) {
295+
nextLanes = getHighestPriorityLanes(lanesToPrewarm);
301296
}
302297
}
303298
}
@@ -786,7 +781,7 @@ export function markRootSuspended(
786781
root.suspendedLanes |= suspendedLanes;
787782
root.pingedLanes &= ~suspendedLanes;
788783

789-
if (enableSiblingPrerendering && didAttemptEntireTree) {
784+
if (didAttemptEntireTree) {
790785
// Mark these lanes as warm so we know there's nothing else to work on.
791786
root.warmLanes |= suspendedLanes;
792787
} else {
@@ -897,7 +892,6 @@ export function markRootFinished(
897892
// suspended) instead of the regular mode (i.e. unwind and skip the siblings
898893
// as soon as something suspends to unblock the rest of the update).
899894
if (
900-
enableSiblingPrerendering &&
901895
suspendedRetryLanes !== NoLanes &&
902896
// Note that we only do this if there were no updates since we started
903897
// rendering. This mirrors the logic in markRootUpdated — whenever we

0 commit comments

Comments
 (0)