From d1d943e5fdfbf4d5a7339aca27df2c66b6607e1e Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 25 Feb 2026 07:24:48 +0000 Subject: [PATCH] fix: Micro-fixes: dead comment, timer null, AbortController, address guard, catch reset (#261) Co-Authored-By: Claude Sonnet 4.6 --- landing/src/components/LiveStats.vue | 5 +++++ landing/src/components/WalletCard.vue | 1 + web-app/src/composables/usePositions.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/landing/src/components/LiveStats.vue b/landing/src/components/LiveStats.vue index 43fae6d..2674334 100644 --- a/landing/src/components/LiveStats.vue +++ b/landing/src/components/LiveStats.vue @@ -362,12 +362,15 @@ const totalSupply = computed(() => { async function fetchStats() { try { + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), 10000); const endpoint = `${window.location.origin}/api/graphql`; const response = await fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json', }, + signal: controller.signal, body: JSON.stringify({ query: ` query ProtocolStats { @@ -391,6 +394,7 @@ async function fetchStats() { }), }); + clearTimeout(timeout); if (!response.ok) { throw new Error('Failed to fetch stats'); } @@ -437,6 +441,7 @@ onMounted(async () => { // Escalate to error state if no data arrives within the timeout window loadingTimer = window.setTimeout(() => { if (!stats.value) error.value = true; + loadingTimer = null; }, LOADING_TIMEOUT_MS); await fetchStats(); fetchEthPrice(); diff --git a/landing/src/components/WalletCard.vue b/landing/src/components/WalletCard.vue index b5bff91..570356c 100644 --- a/landing/src/components/WalletCard.vue +++ b/landing/src/components/WalletCard.vue @@ -40,6 +40,7 @@ async function fetchWalletData(addr: string) { stats.value = json?.data?.statss?.items?.[0] ?? null; } catch { holder.value = null; + stats.value = null; } finally { loading.value = false; } diff --git a/web-app/src/composables/usePositions.ts b/web-app/src/composables/usePositions.ts index 0161dd0..80998d7 100644 --- a/web-app/src/composables/usePositions.ts +++ b/web-app/src/composables/usePositions.ts @@ -189,6 +189,7 @@ export async function loadActivePositions(chainId: number, endpointOverride?: st // since GraphQL returns them as numeric strings export async function loadMyClosedPositions(chainId: number, endpointOverride: string | undefined, account: GetAccountReturnType) { + if (!account.address) return []; const targetEndpoint = resolveGraphqlEndpoint(chainId, endpointOverride); logger.info(`loadMyClosedPositions for chainId: ${chainId}`); const res = await axios.post(