Preserve loaded logs across same-server fleet updates

This commit is contained in:
2026-10-04 17:32:18 -04:00
parent 2413c29fc0
commit 19f1f4e279
3 changed files with 38 additions and 3 deletions
+4
View File
@@ -14,6 +14,7 @@ export interface LogResponse {
interface Selection { server: string; key: string; lines: number }
interface Options {
onReset: () => void;
onData: (key: string, response: LogResponse) => void;
onError: (message: string) => void;
onLoading: (loading: boolean) => void;
@@ -73,6 +74,9 @@ export function createLogRefresh(options: Options) {
automatic = enabled;
interval = pollMs;
if (changed || pausing) cancel();
// Fleet updates can replace the parent server object without changing
// this identity. Only navigation to a different server invalidates logs.
if (selection?.server !== target.server) options.onReset();
if (changed) { selection = target; options.onError(''); }
if (!selection?.key) return;
if (automatic) stopPolling = pollVisible(refresh, interval);