Discard late Fleet history replies after changing selected node

This commit is contained in:
archipelago
2026-10-06 06:54:46 -04:00
parent a0cb29744d
commit cb33fe26e4
2 changed files with 31 additions and 2 deletions
+9 -2
View File
@@ -273,6 +273,7 @@ export function useFleetData() {
const sortBy = ref<SortOption>(cached.sortBy ?? 'status')
const chartWidth = ref(300)
let pollTimer: ReturnType<typeof setInterval> | null = null
let historyRequest = 0
// --- Computed ---
@@ -384,17 +385,20 @@ export function useFleetData() {
}
async function fetchNodeHistory(nodeId: string) {
const request = ++historyRequest
nodeHistoryLoading.value = true
try {
const data = await rpcClient.call<{ history?: NodeHistoryEntry[]; entries?: NodeHistoryEntry[] }>({
method: 'telemetry.fleet-node-history',
params: { node_id: nodeId },
})
nodeHistory.value = normalizeNodeHistoryResponse(data)
if (request === historyRequest && selectedNodeId.value === nodeId) {
nodeHistory.value = normalizeNodeHistoryResponse(data)
}
} catch {
// Non-critical
} finally {
nodeHistoryLoading.value = false
if (request === historyRequest) nodeHistoryLoading.value = false
}
}
@@ -477,6 +481,9 @@ export function useFleetData() {
// Fetch node history when selection changes
watch(selectedNodeId, (newId) => {
historyRequest++
nodeHistory.value = []
nodeHistoryLoading.value = false
if (newId) {
fetchNodeHistory(newId)
} else {