@samitouri / QOS-React-2 / commits / 7b0642bb98

Remove revertRemovalOfSiblingPrerendering killswitch (#26549)

removal of sibling prerendering has been rolled out at Meta. We can delete the flag now.

Samuel Susla committed Apr 13, 2023 at 02:05 UTC 7b0642bb989ec659c6c9891ea16daa0420caab4d
9 files changed +10 -57
packages/react-reconciler/src/ReactFiberWorkLoop.js
+10 -40
@@ -38,7 +38,6 @@ import {
38 enableCache,
39 enableTransitionTracing,
40 useModernStrictMode,
41 - revertRemovalOfSiblingPrerendering,
41 disableLegacyContext,
42 } from 'shared/ReactFeatureFlags';
43 import ReactSharedInternals from 'shared/ReactSharedInternals';
@@ -2441,28 +2440,14 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
2440 // sibling. If there are no more siblings, return to the parent fiber.
2441 let completedWork: Fiber = unitOfWork;
2442 do {
2444 - if (revertRemovalOfSiblingPrerendering) {
2443 + if (__DEV__) {
2444 if ((completedWork.flags & Incomplete) !== NoFlags) {
2446 - // This fiber did not complete, because one of its children did not
2447 - // complete. Switch to unwinding the stack instead of completing it.
2448 - //
2449 - // The reason "unwind" and "complete" is interleaved is because when
2450 - // something suspends, we continue rendering the siblings even though
2451 - // they will be replaced by a fallback.
2452 - // TODO: Disable sibling prerendering, then remove this branch.
2453 - unwindUnitOfWork(completedWork);
2454 - return;
2455 - }
2456 - } else {
2457 - if (__DEV__) {
2458 - if ((completedWork.flags & Incomplete) !== NoFlags) {
2459 - // NOTE: If we re-enable sibling prerendering in some cases, this branch
2460 - // is where we would switch to the unwinding path.
2461 - console.error(
2462 - 'Internal React error: Expected this fiber to be complete, but ' +
2463 - "it isn't. It should have been unwound. This is a bug in React.",
2464 - );
2465 - }
2445 + // NOTE: If we re-enable sibling prerendering in some cases, this branch
2446 + // is where we would switch to the unwinding path.
2447 + console.error(
2448 + 'Internal React error: Expected this fiber to be complete, but ' +
2449 + "it isn't. It should have been unwound. This is a bug in React.",
2450 + );
2451 }
2452 }
2453
@@ -2566,24 +2551,9 @@ function unwindUnitOfWork(unitOfWork: Fiber): void {
2551 returnFiber.deletions = null;
2552 }
2553
2569 - if (revertRemovalOfSiblingPrerendering) {
2570 - // If there are siblings, work on them now even though they're going to be
2571 - // replaced by a fallback. We're "prerendering" them. Historically our
2572 - // rationale for this behavior has been to initiate any lazy data requests
2573 - // in the siblings, and also to warm up the CPU cache.
2574 - // TODO: Don't prerender siblings. With `use`, we suspend the work loop
2575 - // until the data has resolved, anyway.
2576 - const siblingFiber = incompleteWork.sibling;
2577 - if (siblingFiber !== null) {
2578 - // This branch will return us to the normal work loop.
2579 - workInProgress = siblingFiber;
2580 - return;
2581 - }
2582 - } else {
2583 - // NOTE: If we re-enable sibling prerendering in some cases, this branch
2584 - // is where we would switch to the normal completion path: check if a
2585 - // sibling exists, and if so, begin work on it.
2586 - }
2554 + // NOTE: If we re-enable sibling prerendering in some cases, here we
2555 + // would switch to the normal completion path: check if a sibling
2556 + // exists, and if so, begin work on it.
2557
2558 // Otherwise, return to the parent
2559 // $FlowFixMe[incompatible-type] we bail out when we get a null
packages/shared/ReactFeatureFlags.js
-5
@@ -22,11 +22,6 @@ export const enableComponentStackLocations = true;
22 // when it rolls out to prod. We should remove these as soon as possible.
23 // -----------------------------------------------------------------------------
24
25 -// This is phrased as a negative so that if someone forgets to add a GK, the
26 -// default is to enable the feature. It should only be overridden if there's
27 -// a regression in prod.
28 -export const revertRemovalOfSiblingPrerendering = false;
29 -
25 // -----------------------------------------------------------------------------
26 // Land or remove (moderate effort)
27 //
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -43,7 +43,6 @@ export const enableScopeAPI = false;
43 export const enableCreateEventHandleAPI = false;
44 export const enableSuspenseCallback = false;
45 export const disableLegacyContext = false;
46 -export const revertRemovalOfSiblingPrerendering = false;
46 export const enableTrustedTypesIntegration = false;
47 export const disableTextareaChildren = false;
48 export const disableModulePatternComponents = false;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -32,7 +32,6 @@ export const enableScopeAPI = false;
32 export const enableCreateEventHandleAPI = false;
33 export const enableSuspenseCallback = false;
34 export const disableLegacyContext = false;
35 -export const revertRemovalOfSiblingPrerendering = false;
35 export const enableTrustedTypesIntegration = false;
36 export const disableTextareaChildren = false;
37 export const disableModulePatternComponents = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -32,7 +32,6 @@ export const enableScopeAPI = false;
32 export const enableCreateEventHandleAPI = false;
33 export const enableSuspenseCallback = false;
34 export const disableLegacyContext = false;
35 -export const revertRemovalOfSiblingPrerendering = false;
35 export const enableTrustedTypesIntegration = false;
36 export const disableTextareaChildren = false;
37 export const disableModulePatternComponents = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.native.js
-1
@@ -32,7 +32,6 @@ export const enableScopeAPI = false;
32 export const enableCreateEventHandleAPI = false;
33 export const enableSuspenseCallback = false;
34 export const disableLegacyContext = false;
35 -export const revertRemovalOfSiblingPrerendering = false;
35 export const enableTrustedTypesIntegration = false;
36 export const disableTextareaChildren = false;
37 export const disableModulePatternComponents = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -32,7 +32,6 @@ export const enableScopeAPI = true;
32 export const enableCreateEventHandleAPI = false;
33 export const enableSuspenseCallback = true;
34 export const disableLegacyContext = false;
35 -export const revertRemovalOfSiblingPrerendering = false;
35 export const enableTrustedTypesIntegration = false;
36 export const disableTextareaChildren = false;
37 export const disableModulePatternComponents = true;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-6
@@ -39,12 +39,6 @@ export const enableSchedulingProfiler = __VARIANT__;
39 // so we don't need to use __VARIANT__ to get extra coverage.
40 export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
41
42 -// This flag only exists so it can be connected to a www GK that acts as a
43 -// killswitch. We don't run our tests against the `true` value because 1) it
44 -// affects too many tests 2) it shouldn't break anything. But it is mildly
45 -// risky, hence this extra precaution.
46 -export const revertRemovalOfSiblingPrerendering = false;
47 -
42 // TODO: These flags are hard-coded to the default values used in open source.
43 // Update the tests so that they pass in either mode, then set these
44 // to __VARIANT__.
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -18,7 +18,6 @@ export const {
18 disableInputAttributeSyncing,
19 disableIEWorkarounds,
20 enableTrustedTypesIntegration,
21 - revertRemovalOfSiblingPrerendering,
21 replayFailedUnitOfWorkWithInvokeGuardedCallback,
22 enableLegacyFBSupport,
23 enableDebugTracing,