next.js
15d2272c - Distinguish in-navigation errors in the instant error overlay (#93843)

Commit
61 days ago
Distinguish in-navigation errors in the instant error overlay (#93843) ### What? When instant validation flags a route that can't load instantly, the overlay shows a warning. This PR (1) distinguishes nav-phase warnings from initial-render ones in the overlay text, and (2) clears the nav-phase warnings on route change so they don't accumulate after the user has moved on. ### Why? The redbox previously couldn't tell whether a route's instant warning was raised while rendering it directly or while navigating into it — the text and stack looked the same. And once one was surfaced, it stuck around even after the user navigated elsewhere, where it was no longer actionable. The two changes together make each warning describe the phase that produced it and only stay visible while it's still relevant. ### Demo - Subnav under Suspense: [cookies](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/41-subnav-cookies) · [fetch](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/42-subnav-fetch) ### How - New in-navigation variants of the body factory messages ("during the initial render or a navigation") let the overlay tell nav warnings apart from initial-render ones. The diagnostic clause stays aligned ("accessed outside of \`<Suspense>\`"); only the phase and consequence change. - The overlay reads the phase off the message, picks a matching headline, and on route change drops nav warnings while keeping initial-render errors in the redbox stack. - Renames the \`GuidanceVariant\` value (\`'navigation' → 'dynamic'\`) that collided with the new in-nav phase concept. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Author
Parents
Loading