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) => {
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
}

View File

@ -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
}

View File

@ -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
}