Skip to content

Document route handler prerender interruptions - #96980

Draft
DavidIlie wants to merge 1 commit into
codex/route-handler-prerender-bailoutfrom
codex/route-handler-bailout-docs
Draft

Document route handler prerender interruptions#96980
DavidIlie wants to merge 1 commit into
codex/route-handler-prerender-bailoutfrom
codex/route-handler-bailout-docs

Conversation

@DavidIlie

Copy link
Copy Markdown
Contributor

What?

Documents how broad error handling in Cache Components GET Route Handlers should preserve framework-controlled prerender interruptions.

Adds TypeScript and JavaScript examples that call unstable_rethrow(error) before application error handling, and distinguishes that behavior from experimental.hideLogsAfterAbort.

Why?

Request-bound and uncached reads intentionally throw while Next.js prospectively executes a GET handler during the build. An existing try/catch can intercept that signal, log a scary-looking error, and make an expected dynamic opt-out look like a failed build.

The migration guide currently mentions log suppression but does not directly connect this Route Handler behavior to unstable_rethrow. Log suppression changes visibility only; it does not preserve framework control flow in a catch block that otherwise handles every error.

How?

Shows request.nextUrl.searchParams inside a mixed application error handler and places unstable_rethrow at the top of the catch. The surrounding text explains what each mechanism does.

Stack

Stacked on #96979, which removes the redundant second prospective execution when dynamic access was already recorded.

Verification

  • npx eslint --config eslint.config.mjs docs/01-app/02-guides/migrating-to-cache-components.mdx
  • Changed-file Prettier check
  • Verified code-block highlight line numbers for both switcher examples

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Stats skipped

Commit: 1a5a9e1
View workflow run

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 1a5a9e1

@DavidIlie DavidIlie closed this Aug 8, 2026
@DavidIlie
DavidIlie force-pushed the codex/route-handler-bailout-docs branch from 76eb19d to cf41e17 Compare August 8, 2026 23:01
@DavidIlie DavidIlie reopened this Aug 8, 2026
@DavidIlie
DavidIlie force-pushed the codex/route-handler-bailout-docs branch from 1f95aeb to 1a5a9e1 Compare August 8, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant