mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
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.
This commit is contained in:
1 parent
9159fb8696
commit
3e2398bbcc
1 file changed
+12
-3
@@ -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<void> {
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user