From fa73c215348d0b12f8d76358b152e195f0f7eaf5 Mon Sep 17 00:00:00 2001 From: nick134 <76399455+nick134-bit@users.noreply.github.com> Date: Thu, 2 May 2024 20:54:27 +0400 Subject: [PATCH 1/2] fix: backup if data is missing --- components/Pages/Dashboard/Dashboard.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/Pages/Dashboard/Dashboard.tsx b/components/Pages/Dashboard/Dashboard.tsx index 2b419ff0..4e21feca 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, From 432bb6d44e3bc0c7722f5d4fbd7dfaaff74214ad Mon Sep 17 00:00:00 2001 From: nick134 <76399455+nick134-bit@users.noreply.github.com> Date: Thu, 2 May 2024 21:02:25 +0400 Subject: [PATCH 2/2] chore: no need for nullcheck --- components/Pages/Bonding/hooks/getCurrentEpoch.ts | 1 - components/Pages/Dashboard/Dashboard.tsx | 4 ++-- 2 files changed, 2 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 4e21feca..71cbad17 100644 --- a/components/Pages/Dashboard/Dashboard.tsx +++ b/components/Pages/Dashboard/Dashboard.tsx @@ -29,8 +29,8 @@ export const Dashboard: FC = () => { const marketCap = circulatingWhaleSupply * (prices?.WHALE || 0) || 0 const mappedDashboardData = dashboardData.dashboardData?.map((data) => { - const apr = (dashboardData?.bondingInfos?.[data?.chainName]?.bondingAPR) || 0; - const buyback = (dashboardData?.bondingInfos?.[data?.chainName]?.buyback) || 0; + const apr = (dashboardData?.bondingInfos?.[data.chainName]?.bondingAPR) || 0; + const buyback = (dashboardData?.bondingInfos?.[data.chainName]?.buyback) || 0; return ({ logoUrl: getChainLogoUrlByName(data.chainName),