Turn off react query subscription for user bets and portfolio history

This commit is contained in:
James Grugett 2022-08-29 16:47:19 -05:00
parent 0318f7a12b
commit 1d948821ca
3 changed files with 3 additions and 15 deletions

View File

@ -95,11 +95,7 @@ export const useUpdatedContracts = (contracts: Contract[] | undefined) => {
export const useUserBetContracts = (userId: string) => { export const useUserBetContracts = (userId: string) => {
const result = useFirestoreQueryData( const result = useFirestoreQueryData(
['contracts', 'bets', userId], ['contracts', 'bets', userId],
getUserBetContractsQuery(userId), getUserBetContractsQuery(userId)
{ subscribe: true, includeMetadataChanges: true },
// Temporary workaround for react-query bug:
// https://github.com/invertase/react-query-firebase/issues/25
{ refetchOnMount: 'always' }
) )
return result.data return result.data
} }

View File

@ -8,11 +8,7 @@ export const usePortfolioHistory = (userId: string, period: Period) => {
const result = useFirestoreQueryData( const result = useFirestoreQueryData(
['portfolio-history', userId, cutoff], ['portfolio-history', userId, cutoff],
getPortfolioHistoryQuery(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' }
) )
return result.data return result.data
} }

View File

@ -9,11 +9,7 @@ import {
export const useUserBets = (userId: string) => { export const useUserBets = (userId: string) => {
const result = useFirestoreQueryData( const result = useFirestoreQueryData(
['bets', userId], ['bets', userId],
getUserBetsQuery(userId), getUserBetsQuery(userId)
{ subscribe: true, includeMetadataChanges: true },
// Temporary workaround for react-query bug:
// https://github.com/invertase/react-query-firebase/issues/25
{ refetchOnMount: 'always' }
) )
return result.data return result.data
} }