fix(hmr): stop unloaded-route edits from wedging browser HMR#6774
fix(hmr): stop unloaded-route edits from wedging browser HMR#6774FarhanAliRaza wants to merge 3 commits into
Conversation
React Router queues manifest updates for lazy routes even when their modules aren't loaded in the browser. Its HMR runtime throws on those entries before clearing the queue, blocking every later hot update until a full page reload. Add a Vite plugin that patches the runtime to skip unloaded routes instead of throwing.
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR fixes a browser HMR wedge in React Router by adding a Vite plugin that patches the react-router HMR runtime at serve time, replacing a
Confidence Score: 5/5Safe to merge — the plugin only runs in dev/serve mode, the regex patch is narrow and well-contained, and the graceful-degradation warn path protects against upstream react-router changes. The Vite plugin replaces a single throw with continue inside the react-router HMR loop, scoped entirely to apply: serve. The regex is carefully anchored to the exact error pattern, and the this.warn() fallback ensures nothing breaks silently if react-router changes its internal structure. The new integration test exercises the exact failure scenario end-to-end. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "test(hmr): derive generated route paths ..." | Re-trigger Greptile |
React Router queues manifest updates for lazy routes even when their modules aren't loaded in the browser. Its HMR runtime throws on those entries before clearing the queue, blocking every later hot update until a full page reload. Add a Vite plugin that patches the runtime to skip unloaded routes instead of throwing.
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features: