Repository navigation
Conversation
The preload watch build asked the parent to send a full-reload on every build, including the first one. That build finishes before Electron starts, so no client is connected, and Vite buffers the message and delivers it to the first client that connects, reloading the page right after it loads. Only forward reload-renderers for rebuilds, like pluginHotRestart does with builtOnce. Fixes electron#4439 Co-Authored-By: Claude <noreply@anthropic.com>
This branch has not been deployed
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.
Summarize your changes:
Fixes #4439.
During
electron-forge start, the preload watch build asked the parent to send afull-reloadfromcloseBundleon every build, including the first one. The first build finishes before Electron is spawned, so no client is connected yet. Vite buffers afull-reloadthat finds no client and delivers it to the first client that connects, so the window's page reloads right after it first loads.subprocess-worker.tsnow only forwardsreload-renderersfor rebuilds, the same waypluginHotRestartusesbuiltOnce.Tests
subprocess-workerspec that runs a preload target in watch mode, copied to a temp dir, and records the IPC messages: the first build sends onlyfirst-build-done, and appending to the preload entry then sendsreload-renderers. It fails onmain(the first build also sendsreload-renderers) and passes with this change.yarn vitest run --project fast packages/plugin/vite/spec/passes, exceptgetBuildDefine:serve with custom server hostinvite.base.config.spec.ts, which fails the same way on an unmodifiedmainon my machine (Windows 11, Node 24).oxfmt --checkandoxlintare clean forpackages/plugin/vite.The fix for #4446 is separate and sent as its own PR. Both add a test to
subprocess-worker.spec.ts, so whichever lands second may need a trivial rebase there.