From bbcbdf542a1575eb130e92d320fcaf641012fb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 9 Mar 2026 21:45:30 +0800 Subject: [PATCH] Add try-catch-finally to switchCaseData to prevent loading stuck on error Co-Authored-By: Claude Opus 4.6 --- .../Discover/Map/Filter/TraceFilter.vue | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Discover/Map/Filter/TraceFilter.vue b/src/components/Discover/Map/Filter/TraceFilter.vue index 5591a7f..473e830 100644 --- a/src/components/Discover/Map/Filter/TraceFilter.vue +++ b/src/components/Discover/Map/Filter/TraceFilter.vue @@ -355,14 +355,19 @@ async function switchCaseData(id, count) { // Do nothing if clicking the same id if (id === showTraceId.value) return; isLoading.value = true; // Always show loading screen - infinit404.value = null; - infinitMaxItems.value = false; - baseInfiniteStart.value = 0; - allMapDataStore.baseTraceId = id; - infiniteData.value = await allMapDataStore.getBaseTraceDetail(); - showTraceId.value = id; // Set after getDetail so the case table finishes loading before switching showTraceId - createCy(); - isLoading.value = false; + try { + infinit404.value = null; + infinitMaxItems.value = false; + baseInfiniteStart.value = 0; + allMapDataStore.baseTraceId = id; + infiniteData.value = await allMapDataStore.getBaseTraceDetail(); + showTraceId.value = id; // Set after getDetail so the case table finishes loading before switching showTraceId + createCy(); + } catch (error) { + console.error("Failed to load data:", error); + } finally { + isLoading.value = false; + } } /**