fix: don't send browser full-reload for server-only modules by default#4034
fix: don't send browser full-reload for server-only modules by default#4034schiller-manuel wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughhotUpdate in the Vite Nitro plugin now classifies changed modules into server-only and shared sets, invalidates server-only modules, and triggers browser full-reloads only when server-only modules exist (honoring the experimental/serverReload flag). Documentation for serverReload was clarified and its default annotation changed; an example config and E2E tests were added. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
52f9839 to
2cd2782
Compare
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/build/vite/plugin.ts`:
- Around line 262-268: The conditional uses
ctx.pluginConfig.experimental?.vite.serverReload which can throw if experimental
exists but vite is undefined; update the check to safely optional-chain through
vite (e.g., ctx.pluginConfig.experimental?.vite?.serverReload) so access to
serverReload is guarded; locate the block around serverOnlyModules/sharedModules
and change the experimental?.vite.serverReload usage in that if-statement to use
?.vite?.serverReload.
2cd2782 to
55086b2
Compare
hotUpdate hook now separates server-only vs shared modules. Browser full-reload only sent when serverReload option is true (default false). Shared modules continue through normal HMR pipeline. Adds e2e tests for both default (no reload) and serverReload:true behaviors.
55086b2 to
f545c4d
Compare
hotUpdate hook was unconditionally sending server.ws.send full-reload when any server-only module was detected, destroying client-side HMR. Split modules into server-only vs shared, only browser-reload when ALL modules are server-only and serverReload is explicitly enabled (default changed from true to false).
closes TanStack/router#5904