@samitouri / QOS-React-1 / commits / 9e2c233139

[flags] Delete enableSuspenseAvoidThisFallbackFizz (#31779)

We're not shipping `enableSuspenseAvoidThisFallback` and the fizz flag is already off so we can delete it.

Ricky committed Dec 14, 2024 at 13:05 UTC 9e2c233139e62ea2f50bfa8986de02044e895c65
13 files changed +1 -206
packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
-12
@@ -3886,18 +3886,6 @@ const clientRenderedSuspenseBoundaryError1D =
3886 const clientRenderedSuspenseBoundaryError2 =
3887 stringToPrecomputedChunk('></template>');
3888
3889 -export function pushStartCompletedSuspenseBoundary(
3890 - target: Array<Chunk | PrecomputedChunk>,
3891 -) {
3892 - target.push(startCompletedSuspenseBoundary);
3893 -}
3894 -
3895 -export function pushEndCompletedSuspenseBoundary(
3896 - target: Array<Chunk | PrecomputedChunk>,
3897 -) {
3898 - target.push(endSuspenseBoundary);
3899 -}
3900 -
3889 export function writeStartCompletedSuspenseBoundary(
3890 destination: Destination,
3891 renderState: RenderState,
packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js
-2
@@ -142,8 +142,6 @@ export {
142 makeId,
143 pushStartInstance,
144 pushEndInstance,
145 - pushStartCompletedSuspenseBoundary,
146 - pushEndCompletedSuspenseBoundary,
145 pushFormStateMarkerIsMatching,
146 pushFormStateMarkerIsNotMatching,
147 writeStartSegment,
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
-145
@@ -2211,151 +2211,6 @@ describe('ReactDOMFizzServer', () => {
2211 expect(getVisibleChildren(container)).toEqual(<div>Hello</div>);
2212 });
2213
2214 - // @gate enableSuspenseAvoidThisFallbackFizz
2215 - it('should respect unstable_avoidThisFallback', async () => {
2216 - const resolved = {
2217 - 0: false,
2218 - 1: false,
2219 - };
2220 - const promiseRes = {};
2221 - const promises = {
2222 - 0: new Promise(res => {
2223 - promiseRes[0] = () => {
2224 - resolved[0] = true;
2225 - res();
2226 - };
2227 - }),
2228 - 1: new Promise(res => {
2229 - promiseRes[1] = () => {
2230 - resolved[1] = true;
2231 - res();
2232 - };
2233 - }),
2234 - };
2235 -
2236 - const InnerComponent = ({isClient, depth}) => {
2237 - if (isClient) {
2238 - // Resuspend after re-rendering on client to check that fallback shows on client
2239 - throw new Promise(() => {});
2240 - }
2241 - if (!resolved[depth]) {
2242 - throw promises[depth];
2243 - }
2244 - return (
2245 - <div>
2246 - <Text text={`resolved ${depth}`} />
2247 - </div>
2248 - );
2249 - };
2250 -
2251 - function App({isClient}) {
2252 - return (
2253 - <div>
2254 - <Text text="Non Suspense Content" />
2255 - <Suspense
2256 - fallback={
2257 - <span>
2258 - <Text text="Avoided Fallback" />
2259 - </span>
2260 - }
2261 - unstable_avoidThisFallback={true}>
2262 - <InnerComponent isClient={isClient} depth={0} />
2263 - <div>
2264 - <Suspense fallback={<Text text="Fallback" />}>
2265 - <Suspense
2266 - fallback={
2267 - <span>
2268 - <Text text="Avoided Fallback2" />
2269 - </span>
2270 - }
2271 - unstable_avoidThisFallback={true}>
2272 - <InnerComponent isClient={isClient} depth={1} />
2273 - </Suspense>
2274 - </Suspense>
2275 - </div>
2276 - </Suspense>
2277 - </div>
2278 - );
2279 - }
2280 -
2281 - await jest.runAllTimers();
2282 -
2283 - await act(() => {
2284 - const {pipe} = renderToPipeableStream(<App isClient={false} />);
2285 - pipe(writable);
2286 - });
2287 -
2288 - // Nothing is output since root has a suspense with avoidedThisFallback that hasn't resolved
2289 - expect(getVisibleChildren(container)).toEqual(undefined);
2290 - expect(container.innerHTML).not.toContain('Avoided Fallback');
2291 -
2292 - // resolve first suspense component with avoidThisFallback
2293 - await act(() => {
2294 - promiseRes[0]();
2295 - });
2296 -
2297 - expect(getVisibleChildren(container)).toEqual(
2298 - <div>
2299 - Non Suspense Content
2300 - <div>resolved 0</div>
2301 - <div>Fallback</div>
2302 - </div>,
2303 - );
2304 -
2305 - expect(container.innerHTML).not.toContain('Avoided Fallback2');
2306 -
2307 - await act(() => {
2308 - promiseRes[1]();
2309 - });
2310 -
2311 - expect(getVisibleChildren(container)).toEqual(
2312 - <div>
2313 - Non Suspense Content
2314 - <div>resolved 0</div>
2315 - <div>
2316 - <div>resolved 1</div>
2317 - </div>
2318 - </div>,
2319 - );
2320 -
2321 - let root;
2322 - await act(async () => {
2323 - root = ReactDOMClient.hydrateRoot(container, <App isClient={false} />);
2324 - await waitForAll([]);
2325 - await jest.runAllTimers();
2326 - });
2327 -
2328 - // No change after hydration
2329 - expect(getVisibleChildren(container)).toEqual(
2330 - <div>
2331 - Non Suspense Content
2332 - <div>resolved 0</div>
2333 - <div>
2334 - <div>resolved 1</div>
2335 - </div>
2336 - </div>,
2337 - );
2338 -
2339 - await act(async () => {
2340 - // Trigger update by changing isClient to true
2341 - root.render(<App isClient={true} />);
2342 - await waitForAll([]);
2343 - await jest.runAllTimers();
2344 - });
2345 -
2346 - // Now that we've resuspended at the root we show the root fallback
2347 - expect(getVisibleChildren(container)).toEqual(
2348 - <div>
2349 - Non Suspense Content
2350 - <div style="display: none;">resolved 0</div>
2351 - <div style="display: none;">
2352 - <div>resolved 1</div>
2353 - </div>
2354 - <span>Avoided Fallback</span>
2355 - </div>,
2356 - );
2357 - });
2358 -
2214 it('calls getServerSnapshot instead of getSnapshot', async () => {
2215 const ref = React.createRef();
2216
packages/react-markup/src/ReactFizzConfigMarkup.js
-2
@@ -49,8 +49,6 @@ export {
49 getChildFormatContext,
50 makeId,
51 pushEndInstance,
52 - pushStartCompletedSuspenseBoundary,
53 - pushEndCompletedSuspenseBoundary,
52 pushFormStateMarkerIsMatching,
53 pushFormStateMarkerIsNotMatching,
54 writeStartSegment,
packages/react-server/src/ReactFizzServer.js
+1 -33
@@ -65,8 +65,6 @@ import {
65 pushTextInstance,
66 pushStartInstance,
67 pushEndInstance,
68 - pushStartCompletedSuspenseBoundary,
69 - pushEndCompletedSuspenseBoundary,
68 pushSegmentFinale,
69 getChildFormatContext,
70 writeHoistables,
@@ -155,7 +153,6 @@ import {
153 disableLegacyContext,
154 disableLegacyContextForFunctionComponents,
155 enableScopeAPI,
158 - enableSuspenseAvoidThisFallbackFizz,
156 enableCache,
157 enablePostpone,
158 enableHalt,
@@ -1490,28 +1487,6 @@ function replaySuspenseBoundary(
1487 request.pingedTasks.push(suspendedFallbackTask);
1488 }
1489
1493 -function renderBackupSuspenseBoundary(
1494 - request: Request,
1495 - task: Task,
1496 - keyPath: KeyNode,
1497 - props: Object,
1498 -) {
1499 - const content = props.children;
1500 - const segment = task.blockedSegment;
1501 - const prevKeyPath = task.keyPath;
1502 - task.keyPath = keyPath;
1503 - if (segment === null) {
1504 - // Replay
1505 - renderNode(request, task, content, -1);
1506 - } else {
1507 - // Render
1508 - pushStartCompletedSuspenseBoundary(segment.chunks);
1509 - renderNode(request, task, content, -1);
1510 - pushEndCompletedSuspenseBoundary(segment.chunks);
1511 - }
1512 - task.keyPath = prevKeyPath;
1513 -}
1514 -
1490 function renderHostElement(
1491 request: Request,
1492 task: Task,
@@ -2194,14 +2169,7 @@ function renderElement(
2169 throw new Error('ReactDOMServer does not yet support scope components.');
2170 }
2171 case REACT_SUSPENSE_TYPE: {
2197 - if (
2198 - enableSuspenseAvoidThisFallbackFizz &&
2199 - props.unstable_avoidThisFallback === true
2200 - ) {
2201 - renderBackupSuspenseBoundary(request, task, keyPath, props);
2202 - } else {
2203 - renderSuspenseBoundary(request, task, keyPath, props);
2204 - }
2172 + renderSuspenseBoundary(request, task, keyPath, props);
2173 return;
2174 }
2175 }
packages/react-server/src/forks/ReactFizzConfig.custom.js
-4
@@ -51,10 +51,6 @@ export const makeId = $$$config.makeId;
51 export const pushTextInstance = $$$config.pushTextInstance;
52 export const pushStartInstance = $$$config.pushStartInstance;
53 export const pushEndInstance = $$$config.pushEndInstance;
54 -export const pushStartCompletedSuspenseBoundary =
55 - $$$config.pushStartCompletedSuspenseBoundary;
56 -export const pushEndCompletedSuspenseBoundary =
57 - $$$config.pushEndCompletedSuspenseBoundary;
54 export const pushSegmentFinale = $$$config.pushSegmentFinale;
55 export const pushFormStateMarkerIsMatching =
56 $$$config.pushFormStateMarkerIsMatching;
packages/shared/ReactFeatureFlags.js
-2
@@ -108,8 +108,6 @@ export const enableLegacyHidden = false;
108
109 // Enables unstable_avoidThisFallback feature in Fiber
110 export const enableSuspenseAvoidThisFallback = false;
111 -// Enables unstable_avoidThisFallback feature in Fizz
112 -export const enableSuspenseAvoidThisFallbackFizz = false;
111
112 export const enableCPUSuspense = __EXPERIMENTAL__;
113
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -73,7 +73,6 @@ export const enableComponentPerformanceTrack = false;
73 export const enableScopeAPI = false;
74 export const enableServerComponentLogs = true;
75 export const enableSuspenseAvoidThisFallback = false;
76 -export const enableSuspenseAvoidThisFallbackFizz = false;
76 export const enableSuspenseCallback = true;
77 export const enableTaint = true;
78 export const enableTransitionTracing = false;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -63,7 +63,6 @@ export const enableScopeAPI = false;
63 export const enableServerComponentLogs = true;
64 export const enableShallowPropDiffing = false;
65 export const enableSuspenseAvoidThisFallback = false;
66 -export const enableSuspenseAvoidThisFallbackFizz = false;
66 export const enableSuspenseCallback = false;
67 export const enableTaint = true;
68 export const enableTransitionTracing = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -33,7 +33,6 @@ export const enableSuspenseCallback = false;
33 export const enableTrustedTypesIntegration = false;
34 export const disableTextareaChildren = false;
35 export const enableSuspenseAvoidThisFallback = false;
36 -export const enableSuspenseAvoidThisFallbackFizz = false;
36 export const enableCPUSuspense = false;
37 export const enableNoCloningMemoCache = false;
38 export const enableUseEffectEventHook = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
-1
@@ -57,7 +57,6 @@ export const enableScopeAPI = false;
57 export const enableServerComponentLogs = true;
58 export const enableShallowPropDiffing = false;
59 export const enableSuspenseAvoidThisFallback = false;
60 -export const enableSuspenseAvoidThisFallbackFizz = false;
60 export const enableSuspenseCallback = false;
61 export const enableTaint = true;
62 export const enableTransitionTracing = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -35,7 +35,6 @@ export const disableLegacyContextForFunctionComponents = false;
35 export const enableTrustedTypesIntegration = false;
36 export const disableTextareaChildren = false;
37 export const enableSuspenseAvoidThisFallback = true;
38 -export const enableSuspenseAvoidThisFallbackFizz = false;
38 export const enableCPUSuspense = false;
39 export const enableNoCloningMemoCache = false;
40 export const enableUseEffectEventHook = false;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -51,7 +51,6 @@ export const enableUpdaterTracking = __PROFILE__;
51 export const enableFabricCompleteRootInCommitPhase = false;
52
53 export const enableSuspenseAvoidThisFallback = true;
54 -export const enableSuspenseAvoidThisFallbackFizz = false;
54
55 export const enableCPUSuspense = true;
56 export const enableUseEffectEventHook = true;