Repository navigation
Conversation
…n HTML-only error page If an error occurs upon hydration and the error page isn't client-side routable (e.g. an HTML-only error page), Vike redirects to the current URL. But the server already rendered that URL: it renders the same page again, the error occurs again upon hydration, and so on — an infinite reload loop if the error persists (e.g. with a client-side hook that always throws, the page was loaded 324 times within 8 seconds). Upon hydration, Vike now leaves the server-side rendered page as it is and falls back to Server Routing: the page isn't hydrated, so Client Routing would otherwise wait forever for the hydration to end upon the next link click. The error is still logged (by handleError()). Upon client-side navigation, Vike still redirects so that the server renders the error page: the client-side can't render an HTML-only error page (without the redirect, the page would be blank). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdMeoWMUuZtWBoUosW7ZqD
Member
Author
|
Closing: this only affects apps whose error page isn't client-side routable (e.g. a server-only Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #3598.
If an error occurs during hydration and the error page isn't client-side routable (e.g. an HTML-only error page), Vike hard-redirects to the current URL. But the server already rendered that URL: it renders the same page again, hydration fails again, and so on. If the error persists, that's an infinite reload loop. In a repro with a client-side hook that always throws, the page was loaded 324 times within 8 seconds.
Upon hydration, Vike now leaves the server-rendered page as it is and falls back to Server Routing. Without that fallback, the next link click would wait forever for the hydration to end. The error is still logged.
Upon client-side navigation, nothing changes: Vike still redirects, so the server renders the error page. That redirect is needed: the client can't render an HTML-only error page. Without the redirect, a server error during navigation leaves a blank page (checked locally).
When this happens
Only if the error page isn't client-side routable:
+Page.server.js,Pagewithenv: { client: false },clientHooks: false, or noonRenderClientapplies to itclientRoutingisn't enabled for itWith vike-react/vue/solid defaults the error page is client-side routable, so this is rare.
Test
New
test/error-page-html-only/(dev and preview): a page whose client-side hook always throws, with an HTML-only error page. It fails without the fix (8 page loads instead of 1). With the fix there's one page load, and links still work.🤖 Generated with Claude Code
https://claude.ai/code/session_01VdMeoWMUuZtWBoUosW7ZqD
Generated by Claude Code