Add try-catch-finally to switchCaseData to prevent loading stuck on error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 21:45:30 +08:00
parent e155c0114f
commit bbcbdf542a

View File

@@ -355,14 +355,19 @@ async function switchCaseData(id, count) {
// Do nothing if clicking the same id // Do nothing if clicking the same id
if (id === showTraceId.value) return; if (id === showTraceId.value) return;
isLoading.value = true; // Always show loading screen isLoading.value = true; // Always show loading screen
infinit404.value = null; try {
infinitMaxItems.value = false; infinit404.value = null;
baseInfiniteStart.value = 0; infinitMaxItems.value = false;
allMapDataStore.baseTraceId = id; baseInfiniteStart.value = 0;
infiniteData.value = await allMapDataStore.getBaseTraceDetail(); allMapDataStore.baseTraceId = id;
showTraceId.value = id; // Set after getDetail so the case table finishes loading before switching showTraceId infiniteData.value = await allMapDataStore.getBaseTraceDetail();
createCy(); showTraceId.value = id; // Set after getDetail so the case table finishes loading before switching showTraceId
isLoading.value = false; createCy();
} catch (error) {
console.error("Failed to load data:", error);
} finally {
isLoading.value = false;
}
} }
/** /**