From ae44bddf7f7912b9d431cd1de4480453846ea621 Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 22 Feb 2026 21:21:45 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20address=20review=20=E2=80=94=20floor=20p?= =?UTF-8?q?rice=20null=20guard,=20fetch=20timeout=20(#171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- landing/src/components/LiveStats.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/landing/src/components/LiveStats.vue b/landing/src/components/LiveStats.vue index 6807e37..f72f949 100644 --- a/landing/src/components/LiveStats.vue +++ b/landing/src/components/LiveStats.vue @@ -221,7 +221,12 @@ async function fetchEthPrice() { const now = Date.now(); if (ethUsdPrice.value !== null && (now - ethPriceCacheTime) < ETH_PRICE_CACHE_MS) return; try { - const resp = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd'); + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), 5000); + const resp = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd', { + signal: controller.signal, + }); + clearTimeout(timeout); if (!resp.ok) throw new Error('ETH price fetch failed'); const data = await resp.json(); if (data.ethereum?.usd) { @@ -359,7 +364,7 @@ const floorPriceAmount = computed(() => { }); const floorPriceDisplay = computed(() => { - if (floorPriceAmount.value == null) return null; + if (floorPriceAmount.value == null) return '—'; const eth = floorPriceAmount.value; if (ethUsdPrice.value) return formatUsd(eth * ethUsdPrice.value); return formatSmallEth(eth);