Skip to content

(8/19) Hydrate export dynamic fallbacks on initial load#93559

Draft
feedthejim wants to merge 1 commit intofeedthejim/export-dynamic-fallback-server-boundary-e2efrom
feedthejim/export-dynamic-fallback-client
Draft

(8/19) Hydrate export dynamic fallbacks on initial load#93559
feedthejim wants to merge 1 commit intofeedthejim/export-dynamic-fallback-server-boundary-e2efrom
feedthejim/export-dynamic-fallback-client

Conversation

@feedthejim
Copy link
Copy Markdown
Contributor

@feedthejim feedthejim commented May 7, 2026

Stack position

Part 8 of 19 in the output export dynamic fallback stack.

Previous PR: #93568 (7/19)
Next PR: #93561 (9/19)

Context

The stack is split so build-time output can land behind experimental.outputExportDynamicFallbacks before the client router behavior is enabled. The target behavior is for output: 'export' apps with parameterized App Router routes to emit fallback HTML/RSC artifacts that a later client can resolve for hard loads and soft navigations.

This PR scope: Client bootstrap for hard loads of fallback documents.

At this point the build can emit fallback documents and RSC data, but a browser hard-load still lands on _fallback.html. This PR makes initial load fetch the route-specific fallback payload and render the requested route.

What changed

  • Adds the fallback bootstrap path for _fallback.html initial loads.
  • Fetches route-specific fallback or not-found RSC instead of hydrating stale _fallback.html data.
  • Uses createRoot for fallback bootstrap and removes the temporary hidden style after the first commit.
  • Removes the hidden original-URL session/global side channel. The requested URL is read directly from window.location.

Deliberately not included

  • Does not make soft navigations work.
  • Does not add segment-cache fallback keying.
  • Does not rely on the removed __NEXT_EXPORT_ORIGINAL_URL mechanism.

Verification

After restacking and autosquashing, I verified the full stack with:

  • pnpm --filter=next build
  • pnpm testonly packages/next/src/lib/output-export-dynamic-fallback.test.ts packages/next/src/lib/output-export-fallback-routes.test.ts packages/next/src/export/helpers/output-export-fallback.test.ts packages/next/src/server/request/fallback-params.test.ts
  • pnpm testonly packages/next/src/client/output-export-fallback.test.ts packages/next/src/client/components/router-reducer/fetch-server-response.test.ts packages/next/src/client/components/router-reducer/create-initial-router-state.test.ts packages/next/src/client/components/segment-cache/cache.test.ts packages/next/src/client/components/segment-cache/vary-path.test.ts
  • pnpm testonly packages/next/src/client/components/router-reducer/compute-changed-path.test.ts packages/next/src/client/flight-data-helpers.test.ts packages/next/src/server/app-render/postponed-state.test.ts
  • pnpm test-start-turbo test/e2e/app-dir-export/test/dynamic-fallback-cache-components.test.ts test/e2e/app-dir-export/test/dynamic-fallback-route-shapes-cache-components.test.ts test/e2e/app-dir-export/test/dynamic-fallback-cache-components-basepath.test.ts test/e2e/app-dir-export/test/dynamic-fallback-optimizations-cache-components.test.ts test/e2e/app-dir-export/test/dynamic-fallback-known-params-cache-components.test.ts test/e2e/app-dir-export/test/dynamic-fallback-conflict.test.ts
  • pnpm test-start-turbo test/e2e/app-dir/output-export-dynamic-fallbacks/output-export-dynamic-fallbacks.test.ts test/e2e/app-dir-export/test/output-export-server-io.test.ts test/e2e/app-dir-export/test/output-export-server-io-use-cache.test.ts test/e2e/app-dir-export/test/dynamic-fallback-server-params.test.ts

Comment thread packages/next/src/client/flight-data-helpers.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Failing test suites

Commit: 7631b89 | About building and testing Next.js

pnpm test-start test/e2e/app-dir/app-prefetch/prefetching.test.ts (job)

  • app dir - prefetching > should immediately render the loading state for a dynamic segment when fetched from higher up in the tree (DD)
Expand output

● app dir - prefetching › should immediately render the loading state for a dynamic segment when fetched from higher up in the tree

thrown: "Exceeded timeout of 60000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

  50 |       }
  51 |
> 52 |       const result = Reflect.apply(target, thisArg, args)
     |                              ^
  53 |       return typeof result === 'function' ? wrapJestTestFn(result) : result
  54 |     },
  55 |     get(target, prop, receiver) {

  at Object.apply (lib/e2e-utils/index.ts:52:30)
  at it (e2e/app-dir/app-prefetch/prefetching.test.ts:314:3)
  at Object.describe (e2e/app-dir/app-prefetch/prefetching.test.ts:11:1)

@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-client branch from 9cadbc0 to 85441e6 Compare May 7, 2026 02:10
@feedthejim feedthejim changed the title Support export dynamic fallback client routing Hydrate export dynamic fallbacks on initial load May 7, 2026
@feedthejim feedthejim changed the base branch from feedthejim/export-dynamic-fallback-build-rsc to feedthejim/export-dynamic-fallback-build-shell May 7, 2026 02:11
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-build-shell branch from e16dd5f to 3fe61af Compare May 7, 2026 03:45
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-client branch from 85441e6 to 15eedd9 Compare May 7, 2026 03:45
@feedthejim feedthejim changed the base branch from feedthejim/export-dynamic-fallback-build-shell to feedthejim/export-dynamic-fallback-server-boundary-e2e May 7, 2026 03:46
@feedthejim feedthejim changed the title Hydrate export dynamic fallbacks on initial load (8/19) Hydrate export dynamic fallbacks on initial load May 7, 2026
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-client branch from 15eedd9 to b5e30e2 Compare May 7, 2026 04:25
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-server-boundary-e2e branch 2 times, most recently from 5754fe7 to 55911a7 Compare May 7, 2026 04:55
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-client branch 3 times, most recently from c77c309 to d01fec2 Compare May 7, 2026 05:37
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-server-boundary-e2e branch from 55911a7 to 9c747f0 Compare May 7, 2026 05:37
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-client branch 2 times, most recently from 892f3c5 to f61bc0a Compare May 7, 2026 13:56
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-client branch from f61bc0a to 7631b89 Compare May 7, 2026 15:47
@feedthejim feedthejim force-pushed the feedthejim/export-dynamic-fallback-server-boundary-e2e branch from 6618a79 to 4129377 Compare May 7, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant