From 1d948821cab578df3f3cbe95cb6626b233e88432 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 29 Aug 2022 16:47:19 -0500 Subject: [PATCH] Turn off react query subscription for user bets and portfolio history --- web/hooks/use-contracts.ts | 6 +----- web/hooks/use-portfolio-history.ts | 6 +----- web/hooks/use-user-bets.ts | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/web/hooks/use-contracts.ts b/web/hooks/use-contracts.ts index f277a209..3ec1c56c 100644 --- a/web/hooks/use-contracts.ts +++ b/web/hooks/use-contracts.ts @@ -95,11 +95,7 @@ export const useUpdatedContracts = (contracts: Contract[] | undefined) => { export const useUserBetContracts = (userId: string) => { const result = useFirestoreQueryData( ['contracts', 'bets', userId], - getUserBetContractsQuery(userId), - { subscribe: true, includeMetadataChanges: true }, - // Temporary workaround for react-query bug: - // https://github.com/invertase/react-query-firebase/issues/25 - { refetchOnMount: 'always' } + getUserBetContractsQuery(userId) ) return result.data } diff --git a/web/hooks/use-portfolio-history.ts b/web/hooks/use-portfolio-history.ts index d5919783..d01ca29b 100644 --- a/web/hooks/use-portfolio-history.ts +++ b/web/hooks/use-portfolio-history.ts @@ -8,11 +8,7 @@ export const usePortfolioHistory = (userId: string, period: Period) => { const result = useFirestoreQueryData( ['portfolio-history', userId, cutoff], - getPortfolioHistoryQuery(userId, cutoff), - { subscribe: true, includeMetadataChanges: true }, - // Temporary workaround for react-query bug: - // https://github.com/invertase/react-query-firebase/issues/25 - { refetchOnMount: 'always' } + getPortfolioHistoryQuery(userId, cutoff) ) return result.data } diff --git a/web/hooks/use-user-bets.ts b/web/hooks/use-user-bets.ts index 72a4e5bf..ff1b23b3 100644 --- a/web/hooks/use-user-bets.ts +++ b/web/hooks/use-user-bets.ts @@ -9,11 +9,7 @@ import { export const useUserBets = (userId: string) => { const result = useFirestoreQueryData( ['bets', userId], - getUserBetsQuery(userId), - { subscribe: true, includeMetadataChanges: true }, - // Temporary workaround for react-query bug: - // https://github.com/invertase/react-query-firebase/issues/25 - { refetchOnMount: 'always' } + getUserBetsQuery(userId) ) return result.data }