From 3e2398bbccbbbd42f0513cd681d72364e9c9ceb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=85=E8=86=80?= Date: Fri, 23 Oct 2026 23:23:51 +0800 Subject: [PATCH] fix(console): discard stale log detail responses An older detail request can finish after a newer selection or close. Discard it so the dialog never shows the previously clicked record. --- app/components/SendLogs.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/components/SendLogs.vue b/app/components/SendLogs.vue index 0c4d2d7..bf1efe0 100644 --- a/app/components/SendLogs.vue +++ b/app/components/SendLogs.vue @@ -146,24 +146,33 @@ function onGroupFilter(value: string): void { emit("filter"); } +/** Bumped by every open/close: only the latest detail request may land. */ +let detailRequest = 0; + async function openDetail(l: SendRecord): Promise { if (l.id == null) return; + const mine = ++detailRequest; detailOpen.value = true; detail.value = null; detailError.value = ""; detailLoading.value = true; try { - detail.value = await loadById(l.id); + const entry = await loadById(l.id); + if (mine === detailRequest) detail.value = entry; } catch (err) { - detailError.value = err instanceof Error ? err.message : String(err); + if (mine === detailRequest) { + detailError.value = err instanceof Error ? err.message : String(err); + } } finally { - detailLoading.value = false; + if (mine === detailRequest) detailLoading.value = false; } } function closeDetail(): void { + detailRequest++; detailOpen.value = false; detail.value = null; + detailLoading.value = false; } function onDetailOpenChange(open: boolean): void {