From a223a84556505d851148e45c98c14cc1bf2a4ba1 Mon Sep 17 00:00:00 2001 From: nick134 <76399455+nick134-bit@users.noreply.github.com> Date: Thu, 2 May 2024 19:29:55 +0200 Subject: [PATCH] fix: backup if data is missing (#564) --- components/Pages/Bonding/hooks/getCurrentEpoch.ts | 1 - components/Pages/Dashboard/Dashboard.tsx | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/Pages/Bonding/hooks/getCurrentEpoch.ts b/components/Pages/Bonding/hooks/getCurrentEpoch.ts index a5555cd5..83765055 100644 --- a/components/Pages/Bonding/hooks/getCurrentEpoch.ts +++ b/components/Pages/Bonding/hooks/getCurrentEpoch.ts @@ -53,7 +53,6 @@ export const getCurrentEpoch = async (client: CosmWasmClient, if (!client || !config?.fee_distributor) { return null } - console.log(config, client) const currentEpoch = await fetchCurrentEpoch(client, config) return { currentEpoch } diff --git a/components/Pages/Dashboard/Dashboard.tsx b/components/Pages/Dashboard/Dashboard.tsx index 2b419ff0..71cbad17 100644 --- a/components/Pages/Dashboard/Dashboard.tsx +++ b/components/Pages/Dashboard/Dashboard.tsx @@ -28,8 +28,10 @@ export const Dashboard: FC = () => { const circulatingWhaleSupply = dashboardData.supply?.circulating / (10 ** 6) || 0 const marketCap = circulatingWhaleSupply * (prices?.WHALE || 0) || 0 const mappedDashboardData = dashboardData.dashboardData?.map((data) => { - const apr = dashboardData.bondingInfos[data.chainName]?.bondingAPR - const buyback = dashboardData.bondingInfos[data.chainName]?.buyback + + const apr = (dashboardData?.bondingInfos?.[data.chainName]?.bondingAPR) || 0; + const buyback = (dashboardData?.bondingInfos?.[data.chainName]?.buyback) || 0; + return ({ logoUrl: getChainLogoUrlByName(data.chainName), chainName: data.chainName,