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:
@@ -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 ----
|
||||
|
||||
Reference in New Issue
Block a user