From c8067669c2c8b26a830eb99ff08aa79dd789eb35 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 5 Jan 2024 12:43:30 +0000 Subject: [PATCH] fix(trading): ensure fees queries always fetch on mount and poll (#5566) --- apps/trading/components/fees-container/fees-container.tsx | 8 +++++++- .../components/fees-container/use-referral-stats.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/trading/components/fees-container/fees-container.tsx b/apps/trading/components/fees-container/fees-container.tsx index 73813df2d..36104c983 100644 --- a/apps/trading/components/fees-container/fees-container.tsx +++ b/apps/trading/components/fees-container/fees-container.tsx @@ -38,7 +38,11 @@ export const FeesContainer = () => { const { data: markets, loading: marketsLoading } = useMarketList(); const { data: programData, loading: programLoading } = - useDiscountProgramsQuery({ errorPolicy: 'ignore' }); + useDiscountProgramsQuery({ + errorPolicy: 'ignore', + fetchPolicy: 'cache-and-network', + pollInterval: 15000, + }); const volumeDiscountWindowLength = programData?.currentVolumeDiscountProgram?.windowLength || 1; @@ -49,6 +53,8 @@ export const FeesContainer = () => { partyId: pubKey || '', }, skip: !pubKey, + fetchPolicy: 'cache-and-network', + pollInterval: 15000, }); const previousEpoch = (Number(feesData?.epoch.id) || 0) - 1; diff --git a/apps/trading/components/fees-container/use-referral-stats.ts b/apps/trading/components/fees-container/use-referral-stats.ts index 10d7df55e..f88e1c195 100644 --- a/apps/trading/components/fees-container/use-referral-stats.ts +++ b/apps/trading/components/fees-container/use-referral-stats.ts @@ -1,4 +1,5 @@ import type { DiscountProgramsQuery, FeesQuery } from './__generated__/Fees'; + export const useReferralStats = ( previousEpoch?: number, referralStats?: NonNullable<