fix: update mainWindowRef on window close/recreate, remove dead code

- Add teamProvisioningService.setMainWindow(null) in window close handler
- Add teamProvisioningService.setMainWindow(mainWindow) in window recreate
  Without this, notification click focused destroyed window instead of new one
- Remove unused dismissAllApprovalNotifications (cleanupRun uses per-requestId dismiss)
This commit is contained in:
iliya 2026-03-21 13:37:12 +02:00
parent 0d74619241
commit b3cc2f1421
2 changed files with 6 additions and 8 deletions

View file

@ -1263,6 +1263,9 @@ function createWindow(): void {
if (ptyTerminalService) {
ptyTerminalService.setMainWindow(null);
}
if (teamProvisioningService) {
teamProvisioningService.setMainWindow(null);
}
setEditorMainWindow(null);
setReviewMainWindow(null);
cleanupEditorState();
@ -1287,6 +1290,9 @@ function createWindow(): void {
if (ptyTerminalService) {
ptyTerminalService.setMainWindow(mainWindow);
}
if (teamProvisioningService) {
teamProvisioningService.setMainWindow(mainWindow);
}
setEditorMainWindow(mainWindow);
setReviewMainWindow(mainWindow);

View file

@ -5449,14 +5449,6 @@ export class TeamProvisioningService {
}
}
/** Dismiss all OS notifications for a team's approvals (e.g. on team stop). */
private dismissAllApprovalNotifications(): void {
for (const [, notification] of this.activeApprovalNotifications) {
notification.close();
}
this.activeApprovalNotifications.clear();
}
private formatToolApprovalBody(toolName: string, toolInput: Record<string, unknown>): string {
switch (toolName) {
case 'Bash':