Decouple dialog refocus from PanelsService via FocusService

Dialogs only needed refocus(); injecting PanelsService boots a whole
workspace, which secondary windows must not do.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jokin
2026-07-13 23:02:25 +02:00
co-authored by Claude Fable 5
parent 93a9b07722
commit 62ff845944
6 changed files with 33 additions and 15 deletions
+5 -3
View File
@@ -1,5 +1,6 @@
import { Injectable, computed, signal, type WritableSignal } from '@angular/core';
import { Injectable, computed, inject, signal, type WritableSignal } from '@angular/core';
import type { ConnectionConfig, FileEntry, SavedConnection } from '@shared/types';
import { FocusService } from './focus.service';
import { RpcService } from './rpc.service';
import { ToastService } from './toast.service';
@@ -201,8 +202,9 @@ export class PanelsService {
const list = this.workspaces();
return list.find((w) => w.id === this.activeWorkspaceId()) ?? list[0];
});
private readonly focus = inject(FocusService);
/** Bumped to tell the active panel to grab keyboard focus again (e.g. after a dialog closes). */
readonly focusTick = signal(0);
readonly focusTick = this.focus.tick;
private nextWorkspaceId = 1;
@@ -265,7 +267,7 @@ export class PanelsService {
}
refocus(): void {
this.focusTick.update((n) => n + 1);
this.focus.bump();
}
// ---- workspace (tab) management ----