mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #958] Forward invalid dynamic usage errors on client-side navigations in dev #206
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#206
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @github-actions[bot] on GitHub (Apr 29, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/958
Next.js Change
In dev mode, the static shell validation only runs during the initial page load and HMR refreshes, not during client-side navigations. During a client-side navigation, an invalid dynamic usage error — for example a
'use cache'fill timeout, or a request API likecookies()called inside a'use cache'scope — does still reach the browser via the errored'use cache'stream. But when the cache invocation is wrapped in a user-spacetry/catch, the error is caught and swallowed in user code, and because the static shell validation isn't running to surface it separately, the error is then neither sent to the browser nor logged to the terminal.This commit makes dev wait for the full render stream to finish when the validation is skipped, and then, if an error was recorded during the render, send it to the browser and log it to the terminal.
Commit:
f5e54c0PR: #93184
What Changed
In
packages/next/src/server/app-render/app-render.tsx: when the static shell validation is skipped (e.g. on a client-side navigation in dev), the renderer now awaits the full render stream and, if any error was recorded during the render (including swallowed-by-user-try/catcherrors that came back via the'use cache'stream), forwards that error both to the browser dev overlay and to the terminal.This mirrors what the static shell validation already does, and ensures we also catch errors from
'use cache'invocations that only run in the dynamic stage.Impact on vinext
This is a developer-experience fix for App Router dev mode. vinext's App Router dev path (
entries/app-rsc-entry.tsand the related dev SSR pipeline) needs to reproduce this behavior so that:'use cache'scopes that misuse request APIs (e.g.cookies()inside'use cache') surface during client-side navigations, not only on full page loads.try/catcharound a'use cache'call doesn't silently swallow the error in dev — the dev server should still log it to the terminal and forward it to the browser overlay.Without this, vinext's dev experience for
'use cache'and request-API misuse will silently diverge from Next.js: errors will appear on initial loads but disappear after a<Link>click.Suggested Action
'use cache'scope that throws (e.g. callscookies()) and is wrapped in usertry/catch, then navigated to via<Link>, asserting the error still surfaces.