Skip to content

Commit 9e2c233

Browse files
authored
[flags] Delete enableSuspenseAvoidThisFallbackFizz (#31779)
We're not shipping `enableSuspenseAvoidThisFallback` and the fizz flag is already off so we can delete it.
1 parent 0d67cc0 commit 9e2c233

13 files changed

+1
-206
lines changed

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3886,18 +3886,6 @@ const clientRenderedSuspenseBoundaryError1D =
38863886
const clientRenderedSuspenseBoundaryError2 =
38873887
stringToPrecomputedChunk('></template>');
38883888

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-
39013889
export function writeStartCompletedSuspenseBoundary(
39023890
destination: Destination,
39033891
renderState: RenderState,

packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ export {
142142
makeId,
143143
pushStartInstance,
144144
pushEndInstance,
145-
pushStartCompletedSuspenseBoundary,
146-
pushEndCompletedSuspenseBoundary,
147145
pushFormStateMarkerIsMatching,
148146
pushFormStateMarkerIsNotMatching,
149147
writeStartSegment,

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

Lines changed: 0 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,151 +2211,6 @@ describe('ReactDOMFizzServer', () => {
22112211
expect(getVisibleChildren(container)).toEqual(<div>Hello</div>);
22122212
});
22132213

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-
23592214
it('calls getServerSnapshot instead of getSnapshot', async () => {
23602215
const ref = React.createRef();
23612216

packages/react-markup/src/ReactFizzConfigMarkup.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ export {
4949
getChildFormatContext,
5050
makeId,
5151
pushEndInstance,
52-
pushStartCompletedSuspenseBoundary,
53-
pushEndCompletedSuspenseBoundary,
5452
pushFormStateMarkerIsMatching,
5553
pushFormStateMarkerIsNotMatching,
5654
writeStartSegment,

packages/react-server/src/ReactFizzServer.js

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ import {
6565
pushTextInstance,
6666
pushStartInstance,
6767
pushEndInstance,
68-
pushStartCompletedSuspenseBoundary,
69-
pushEndCompletedSuspenseBoundary,
7068
pushSegmentFinale,
7169
getChildFormatContext,
7270
writeHoistables,
@@ -155,7 +153,6 @@ import {
155153
disableLegacyContext,
156154
disableLegacyContextForFunctionComponents,
157155
enableScopeAPI,
158-
enableSuspenseAvoidThisFallbackFizz,
159156
enableCache,
160157
enablePostpone,
161158
enableHalt,
@@ -1490,28 +1487,6 @@ function replaySuspenseBoundary(
14901487
request.pingedTasks.push(suspendedFallbackTask);
14911488
}
14921489

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-
15151490
function renderHostElement(
15161491
request: Request,
15171492
task: Task,
@@ -2194,14 +2169,7 @@ function renderElement(
21942169
throw new Error('ReactDOMServer does not yet support scope components.');
21952170
}
21962171
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);
22052173
return;
22062174
}
22072175
}

packages/react-server/src/forks/ReactFizzConfig.custom.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ export const makeId = $$$config.makeId;
5151
export const pushTextInstance = $$$config.pushTextInstance;
5252
export const pushStartInstance = $$$config.pushStartInstance;
5353
export const pushEndInstance = $$$config.pushEndInstance;
54-
export const pushStartCompletedSuspenseBoundary =
55-
$$$config.pushStartCompletedSuspenseBoundary;
56-
export const pushEndCompletedSuspenseBoundary =
57-
$$$config.pushEndCompletedSuspenseBoundary;
5854
export const pushSegmentFinale = $$$config.pushSegmentFinale;
5955
export const pushFormStateMarkerIsMatching =
6056
$$$config.pushFormStateMarkerIsMatching;

packages/shared/ReactFeatureFlags.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ export const enableLegacyHidden = false;
108108

109109
// Enables unstable_avoidThisFallback feature in Fiber
110110
export const enableSuspenseAvoidThisFallback = false;
111-
// Enables unstable_avoidThisFallback feature in Fizz
112-
export const enableSuspenseAvoidThisFallbackFizz = false;
113111

114112
export const enableCPUSuspense = __EXPERIMENTAL__;
115113

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const enableComponentPerformanceTrack = false;
7373
export const enableScopeAPI = false;
7474
export const enableServerComponentLogs = true;
7575
export const enableSuspenseAvoidThisFallback = false;
76-
export const enableSuspenseAvoidThisFallbackFizz = false;
7776
export const enableSuspenseCallback = true;
7877
export const enableTaint = true;
7978
export const enableTransitionTracing = false;

packages/shared/forks/ReactFeatureFlags.native-oss.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export const enableScopeAPI = false;
6363
export const enableServerComponentLogs = true;
6464
export const enableShallowPropDiffing = false;
6565
export const enableSuspenseAvoidThisFallback = false;
66-
export const enableSuspenseAvoidThisFallbackFizz = false;
6766
export const enableSuspenseCallback = false;
6867
export const enableTaint = true;
6968
export const enableTransitionTracing = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const enableSuspenseCallback = false;
3333
export const enableTrustedTypesIntegration = false;
3434
export const disableTextareaChildren = false;
3535
export const enableSuspenseAvoidThisFallback = false;
36-
export const enableSuspenseAvoidThisFallbackFizz = false;
3736
export const enableCPUSuspense = false;
3837
export const enableNoCloningMemoCache = false;
3938
export const enableUseEffectEventHook = false;

0 commit comments

Comments
 (0)