mirror of
https://github.com/got-feedBack/feedBack-desktop.git
synced 2026-09-10 22:04:11 +00:00
fix(panes): let toggleWindow be the authority, not a stale hasWindow() check
The tray menu asked "do we own a window for this pane?" and then acted on the answer. Windows are destroyed asynchronously, so between the question and the act the answer can go stale: hasWindow() says yes, the window is destroyed, toggleWindow() returns false, the handler has already committed to the main-process path and returns — and the click lands on nothing. A tray item that silently does nothing is the worst possible failure here, because the tray IS the recovery path when a pane is out of sight. toggleWindow() already reports whether it did anything. Use that: if it toggled, we're done; if it didn't, we never had that window (or just lost it), and only the renderer can decide what opening the pane means — it might belong in the dock, and its element lives there. hasWindow()/hasPaneWindow() existed only to support the racy check, so they're gone rather than left lying around for someone to reintroduce the race with. Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
+1
-2
@@ -128,7 +128,7 @@ import { installAppMenu } from './app-menu';
|
||||
import { sanitizeWindowBounds, MIN_WIDTH, MIN_HEIGHT } from './window-bounds';
|
||||
import {
|
||||
initPaneHosts, closeAllPanes, adoptPaneWindow, paneIdFromFrameName,
|
||||
togglePaneWindow, showAllPaneWindows, hideAllPaneWindows, hasPaneWindow,
|
||||
togglePaneWindow, showAllPaneWindows, hideAllPaneWindows,
|
||||
} from './pane-hosts';
|
||||
import { initTray, destroyTray } from './pane-tray';
|
||||
|
||||
@@ -1199,7 +1199,6 @@ async function startup(): Promise<void> {
|
||||
toggleWindow: togglePaneWindow,
|
||||
showAll: showAllPaneWindows,
|
||||
hideAll: hideAllPaneWindows,
|
||||
hasWindow: hasPaneWindow,
|
||||
});
|
||||
|
||||
// Install our application menu (replaces Electron's default so View →
|
||||
|
||||
Reference in New Issue
Block a user