diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index 9883ba4454df4..04aaf0c2ac706 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -3886,18 +3886,6 @@ const clientRenderedSuspenseBoundaryError1D = const clientRenderedSuspenseBoundaryError2 = stringToPrecomputedChunk('>'); -export function pushStartCompletedSuspenseBoundary( - target: Array, -) { - target.push(startCompletedSuspenseBoundary); -} - -export function pushEndCompletedSuspenseBoundary( - target: Array, -) { - target.push(endSuspenseBoundary); -} - export function writeStartCompletedSuspenseBoundary( destination: Destination, renderState: RenderState, diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js index 725ee666f52af..e4cd9ca93d99e 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOMLegacy.js @@ -142,8 +142,6 @@ export { makeId, pushStartInstance, pushEndInstance, - pushStartCompletedSuspenseBoundary, - pushEndCompletedSuspenseBoundary, pushFormStateMarkerIsMatching, pushFormStateMarkerIsNotMatching, writeStartSegment, diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js index 9dcd4c6945884..777f067a183e8 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js @@ -2211,151 +2211,6 @@ describe('ReactDOMFizzServer', () => { expect(getVisibleChildren(container)).toEqual(
Hello
); }); - // @gate enableSuspenseAvoidThisFallbackFizz - it('should respect unstable_avoidThisFallback', async () => { - const resolved = { - 0: false, - 1: false, - }; - const promiseRes = {}; - const promises = { - 0: new Promise(res => { - promiseRes[0] = () => { - resolved[0] = true; - res(); - }; - }), - 1: new Promise(res => { - promiseRes[1] = () => { - resolved[1] = true; - res(); - }; - }), - }; - - const InnerComponent = ({isClient, depth}) => { - if (isClient) { - // Resuspend after re-rendering on client to check that fallback shows on client - throw new Promise(() => {}); - } - if (!resolved[depth]) { - throw promises[depth]; - } - return ( -
- -
- ); - }; - - function App({isClient}) { - return ( -
- - - - - } - unstable_avoidThisFallback={true}> - -
- }> - - - - } - unstable_avoidThisFallback={true}> - - - -
-
-
- ); - } - - await jest.runAllTimers(); - - await act(() => { - const {pipe} = renderToPipeableStream(); - pipe(writable); - }); - - // Nothing is output since root has a suspense with avoidedThisFallback that hasn't resolved - expect(getVisibleChildren(container)).toEqual(undefined); - expect(container.innerHTML).not.toContain('Avoided Fallback'); - - // resolve first suspense component with avoidThisFallback - await act(() => { - promiseRes[0](); - }); - - expect(getVisibleChildren(container)).toEqual( -
- Non Suspense Content -
resolved 0
-
Fallback
-
, - ); - - expect(container.innerHTML).not.toContain('Avoided Fallback2'); - - await act(() => { - promiseRes[1](); - }); - - expect(getVisibleChildren(container)).toEqual( -
- Non Suspense Content -
resolved 0
-
-
resolved 1
-
-
, - ); - - let root; - await act(async () => { - root = ReactDOMClient.hydrateRoot(container, ); - await waitForAll([]); - await jest.runAllTimers(); - }); - - // No change after hydration - expect(getVisibleChildren(container)).toEqual( -
- Non Suspense Content -
resolved 0
-
-
resolved 1
-
-
, - ); - - await act(async () => { - // Trigger update by changing isClient to true - root.render(); - await waitForAll([]); - await jest.runAllTimers(); - }); - - // Now that we've resuspended at the root we show the root fallback - expect(getVisibleChildren(container)).toEqual( -
- Non Suspense Content -
resolved 0
-
-
resolved 1
-
- Avoided Fallback -
, - ); - }); - it('calls getServerSnapshot instead of getSnapshot', async () => { const ref = React.createRef(); diff --git a/packages/react-markup/src/ReactFizzConfigMarkup.js b/packages/react-markup/src/ReactFizzConfigMarkup.js index 6b43d0bad39a7..048e54933930d 100644 --- a/packages/react-markup/src/ReactFizzConfigMarkup.js +++ b/packages/react-markup/src/ReactFizzConfigMarkup.js @@ -49,8 +49,6 @@ export { getChildFormatContext, makeId, pushEndInstance, - pushStartCompletedSuspenseBoundary, - pushEndCompletedSuspenseBoundary, pushFormStateMarkerIsMatching, pushFormStateMarkerIsNotMatching, writeStartSegment, diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index f245861ba0012..ad6721ec60796 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -65,8 +65,6 @@ import { pushTextInstance, pushStartInstance, pushEndInstance, - pushStartCompletedSuspenseBoundary, - pushEndCompletedSuspenseBoundary, pushSegmentFinale, getChildFormatContext, writeHoistables, @@ -155,7 +153,6 @@ import { disableLegacyContext, disableLegacyContextForFunctionComponents, enableScopeAPI, - enableSuspenseAvoidThisFallbackFizz, enableCache, enablePostpone, enableHalt, @@ -1490,28 +1487,6 @@ function replaySuspenseBoundary( request.pingedTasks.push(suspendedFallbackTask); } -function renderBackupSuspenseBoundary( - request: Request, - task: Task, - keyPath: KeyNode, - props: Object, -) { - const content = props.children; - const segment = task.blockedSegment; - const prevKeyPath = task.keyPath; - task.keyPath = keyPath; - if (segment === null) { - // Replay - renderNode(request, task, content, -1); - } else { - // Render - pushStartCompletedSuspenseBoundary(segment.chunks); - renderNode(request, task, content, -1); - pushEndCompletedSuspenseBoundary(segment.chunks); - } - task.keyPath = prevKeyPath; -} - function renderHostElement( request: Request, task: Task, @@ -2194,14 +2169,7 @@ function renderElement( throw new Error('ReactDOMServer does not yet support scope components.'); } case REACT_SUSPENSE_TYPE: { - if ( - enableSuspenseAvoidThisFallbackFizz && - props.unstable_avoidThisFallback === true - ) { - renderBackupSuspenseBoundary(request, task, keyPath, props); - } else { - renderSuspenseBoundary(request, task, keyPath, props); - } + renderSuspenseBoundary(request, task, keyPath, props); return; } } diff --git a/packages/react-server/src/forks/ReactFizzConfig.custom.js b/packages/react-server/src/forks/ReactFizzConfig.custom.js index 02ce1e4e2afee..be14f349aa286 100644 --- a/packages/react-server/src/forks/ReactFizzConfig.custom.js +++ b/packages/react-server/src/forks/ReactFizzConfig.custom.js @@ -51,10 +51,6 @@ export const makeId = $$$config.makeId; export const pushTextInstance = $$$config.pushTextInstance; export const pushStartInstance = $$$config.pushStartInstance; export const pushEndInstance = $$$config.pushEndInstance; -export const pushStartCompletedSuspenseBoundary = - $$$config.pushStartCompletedSuspenseBoundary; -export const pushEndCompletedSuspenseBoundary = - $$$config.pushEndCompletedSuspenseBoundary; export const pushSegmentFinale = $$$config.pushSegmentFinale; export const pushFormStateMarkerIsMatching = $$$config.pushFormStateMarkerIsMatching; diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 212afaabc4216..f28d123e61e5b 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -108,8 +108,6 @@ export const enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber export const enableSuspenseAvoidThisFallback = false; -// Enables unstable_avoidThisFallback feature in Fizz -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 7493a34494d82..4d89fa091061a 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -73,7 +73,6 @@ export const enableComponentPerformanceTrack = false; export const enableScopeAPI = false; export const enableServerComponentLogs = true; export const enableSuspenseAvoidThisFallback = false; -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseCallback = true; export const enableTaint = true; export const enableTransitionTracing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index e034a723d7574..0407f01910b75 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -63,7 +63,6 @@ export const enableScopeAPI = false; export const enableServerComponentLogs = true; export const enableShallowPropDiffing = false; export const enableSuspenseAvoidThisFallback = false; -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseCallback = false; export const enableTaint = true; export const enableTransitionTracing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index fe518f955e949..b83cb9a99fc3d 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -33,7 +33,6 @@ export const enableSuspenseCallback = false; export const enableTrustedTypesIntegration = false; export const disableTextareaChildren = false; export const enableSuspenseAvoidThisFallback = false; -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = false; export const enableNoCloningMemoCache = false; export const enableUseEffectEventHook = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js index 0b0da8b8cb326..115117685aeb4 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js @@ -57,7 +57,6 @@ export const enableScopeAPI = false; export const enableServerComponentLogs = true; export const enableShallowPropDiffing = false; export const enableSuspenseAvoidThisFallback = false; -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseCallback = false; export const enableTaint = true; export const enableTransitionTracing = false; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 63f76b4a3a7c4..cad15eecc8c11 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -35,7 +35,6 @@ export const disableLegacyContextForFunctionComponents = false; export const enableTrustedTypesIntegration = false; export const disableTextareaChildren = false; export const enableSuspenseAvoidThisFallback = true; -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = false; export const enableNoCloningMemoCache = false; export const enableUseEffectEventHook = false; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index f54c73a4647d4..eea2ba4230f50 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -51,7 +51,6 @@ export const enableUpdaterTracking = __PROFILE__; export const enableFabricCompleteRootInCommitPhase = false; export const enableSuspenseAvoidThisFallback = true; -export const enableSuspenseAvoidThisFallbackFizz = false; export const enableCPUSuspense = true; export const enableUseEffectEventHook = true;