Repository navigation
fix: Register IPC handlers only once to avoid blank window - #361
Merged
morishin merged 1 commit intoSep 10, 2026
Merged
Conversation
createWindow() re-registered ipcMain.handle("getConfig") on every call, so
the second call threw "Attempted to register a second handler" and skipped
win.loadURL(), leaving a blank window. Register the handlers once per
process and resolve the target window from the sender.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The updated showUpdateQueryDialog flow is still async while the renderer uses ipcRenderer.sendSync, which can return undefined or deadlock unless the main handler is made synchronous (or both sides are migrated to invoke/handle).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes an Electron main-process lifecycle issue where closing and reopening the window could result in a blank window due to IPC handlers being re-registered on each createWindow() call.
Changes:
- Refactors IPC registration into a one-time
registerIpcHandlers()guarded by a module-level flag. - Updates IPC listeners to resolve the target
BrowserWindowfromevent.senderrather than capturing a specificwininstance.
File summaries
| File | Description |
|---|---|
src/main/window.ts |
Registers IPC handlers once per process and resolves the originating window per IPC event to avoid duplicate handler errors and blank-window loads. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
This will fix the issue where only a blank window is displayed when the window is closed and reopened.
createWindow() re-registered ipcMain.handle("getConfig") on every call, so the second call threw "Attempted to register a second handler" and skipped win.loadURL(), leaving a blank window. Register the handlers once per process and resolve the target window from the sender.
A screenshot of the blank window: