fix(view-windows): réconcilier l'état des fenêtres détachées au boot (#50)
Branche le consommateur frontend sur la commande backend `list_open_view_windows` : le port window expose la liste des fenêtres de panneaux détachées réellement ouvertes côté OS, l'adaptateur Tauri (et son double mock) l'implémente, et `ProjectsView` réconcilie le placement des vues au démarrage à partir de ce snapshot au lieu de supposer un état. Couvre `viewPlacement` et la réconciliation par des tests dédiés. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -14,7 +14,11 @@ import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
|
||||
import type { Unsubscribe } from "@/domain";
|
||||
import type { ViewWindowClosed, WindowGateway } from "@/ports";
|
||||
import type {
|
||||
ViewWindowClosed,
|
||||
ViewWindowSnapshot,
|
||||
WindowGateway,
|
||||
} from "@/ports";
|
||||
|
||||
/** The single Tauri event carrying detached-window lifecycle transitions. */
|
||||
const VIEW_WINDOW_LIFECYCLE = "view-window://lifecycle";
|
||||
@ -41,6 +45,12 @@ export class TauriWindowGateway implements WindowGateway {
|
||||
await invoke("close_view_window", { panel });
|
||||
}
|
||||
|
||||
async listOpenViewWindows(): Promise<ViewWindowSnapshot[]> {
|
||||
// Backend serialises the snapshots in camelCase (panel/label/visible), so the
|
||||
// wire shape matches the port type directly.
|
||||
return invoke<ViewWindowSnapshot[]>("list_open_view_windows");
|
||||
}
|
||||
|
||||
async onViewWindowClosed(
|
||||
handler: (event: ViewWindowClosed) => void,
|
||||
): Promise<Unsubscribe> {
|
||||
|
||||
Reference in New Issue
Block a user