Preserve loaded logs across same-server fleet updates
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user