fix: recover from SSR errors in dev without a manual refresh#2256
Closed
birkskyum wants to merge 2 commits into
Closed
fix: recover from SSR errors in dev without a manual refresh#2256birkskyum wants to merge 2 commits into
birkskyum wants to merge 2 commits into
Conversation
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: cea0314 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
birkskyum
marked this pull request as draft
July 27, 2026 00:33
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.
Problem
A syntax error in
app.tsxleaves a 500 page that never recovers: fixing the file does nothing until you refresh by hand.The
ErrorOverlaybranch indev-server.tslooks like it covers this, but it is unreachable in a standard v2 app.configureServerbails out early when the server environment hasdispatchFetch, and Nitro implements exactly that, so Nitro renders its own error page with no/@vite/clienton it. None of that page's modules are registered for HMR, so theupdatethat fixes the file is dropped, and Vite's client only self-reloads when the page has avite-error-overlaymounted or receives afull-reload.Fix
A dev middleware buffers HTML 5xx responses and appends a script that connects them to the HMR channel and reloads once the server renders again. Anything that is not an HTML 5xx passes through untouched, as do pages that already talk to the HMR client.
Two details worth calling out:
writeHeadarguments rather than onres, and Nitro passes headers as a flat[name, value, ...]array. Reading onlyres.statusCodenever detects the error, and leavingcontent-lengthin the array form truncates the body.Testing
15 unit tests over injection, both
writeHeadheader forms, and the middleware's buffering and pass-through paths. Verified the reporter's repro in Chromium: breakapp.tsx, fix it, page recovers on its own in ~0.5s. Units, typecheck, both e2e suites, andformat:checkpass.