mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1027] [MERGED] fix(hmr): full-reload after a render error tears down BrowserRoot #1032
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#1032
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?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/1027
Author: @james-elicx
Created: 5/2/2026
Status: ✅ Merged
Merged: 5/2/2026
Merged by: @james-elicx
Base:
main← Head:fix/hmr-auto-reload-after-tear-down📝 Commits (1)
24a2a1efix(hmr): full-reload after a render error tears down BrowserRoot📊 Changes
1 file changed (+21 additions, -6 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-entry.ts(+21 -6)📄 Description
Summary
BrowserRoot, which clearssetBrowserRouterState/browserRouterStateRef. After #1026 thersc:updateHMR handler bails silently in that state, leaving HMR effectively dead until a manual hard-refresh — the user's fix never lands automatically.browserRouterStateHasEverCommittedflag (set inmarkBrowserRouterStateReady). When HMR fires and the tree was up before but isn't now, triggerwindow.location.reload()so the next push reconciles via a fresh load.Loop safety
hasEverCommitted && !ref— i.e. previously mounted, currently torn down. After the reload, if the broken code prevents BrowserRoot from mounting at all,hasEverCommittedisfalseon the new page load and subsequent HMR events fall through to the existing wait-for-readiness path. So no reload loop.Test plan
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.