Skip to content

fix: Register IPC handlers only once to avoid blank window - #361

Merged
morishin merged 1 commit into
bdash-app:masterfrom
nekketsuuu:nekketsuuu-fix-blank-window
Sep 10, 2026
Merged

morishin merged 1 commit into
bdash-app:masterfrom
nekketsuuu:nekketsuuu-fix-blank-window

Conversation

@nekketsuuu

@nekketsuuu nekketsuuu commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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:

blank window

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 BrowserWindow from event.sender rather than capturing a specific win instance.
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.

Comment thread src/main/window.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change directly addresses duplicate IPC registration while preserving multi-window behavior.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@morishin morishin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@morishin
morishin merged commit 6042446 into bdash-app:master Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants