Skip to content

Commit

Permalink
perf: Don't use query key
Browse files Browse the repository at this point in the history
  • Loading branch information
memoyil committed Apr 16, 2024
1 parent f864d41 commit 0116675
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion apps/gamification/hooks/useTokenBalance.ts
Expand Up @@ -32,7 +32,7 @@ export const useTokenBalanceByChain = (tokenAddress: Address, chainIdOverride?:
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return {
...rest,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/hooks/useStableSwapInfo.ts
Expand Up @@ -67,7 +67,7 @@ export function useStableSwapInfo(stableSwapAddress: Address | undefined, lpAddr
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

const feeNumerator = results?.[4]?.result
const feeDenominator = results?.[5]?.result
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/hooks/useTokenBalance.ts
Expand Up @@ -33,7 +33,7 @@ export const useTokenBalanceByChain = (tokenAddress: Address, chainIdOverride?:
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryClient, queryKey.toString()])
}, [blockNumber, queryClient])

return {
...rest,
Expand All @@ -59,7 +59,7 @@ export const useGetBnbBalance = () => {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryClient, queryKey.toString()])
}, [blockNumber, queryClient])

return { balance: data?.value ? BigInt(data.value) : 0n, fetchStatus: status, refresh: refetch }
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/hooks/v3/useV3Positions.ts
Expand Up @@ -55,7 +55,7 @@ export function useV3PositionsFromTokenIds(tokenIds: bigint[] | undefined): UseV
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return {
loading: isLoading,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/state/nftMarket/hooks.ts
Expand Up @@ -77,7 +77,7 @@ export const useApprovalNfts = (nftsInWallet: NftToken[]) => {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

const profileAddress = getPancakeProfileAddress()

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/state/user/hooks/index.tsx
Expand Up @@ -272,7 +272,7 @@ export function useFeeDataWithGasPrice(chainIdOverride?: number): {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

if (gasPrice) {
return {
Expand Down
Expand Up @@ -32,7 +32,7 @@ export const useProxyVeCakeBalance = () => {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return {
balance: useMemo(() => (typeof data !== 'undefined' ? new BigNumber(data.toString()) : BIG_ZERO), [data]),
Expand Down
Expand Up @@ -34,7 +34,7 @@ export const useProxyVeCakeBalanceOfAtTime = (timestamp: number) => {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return {
balance: useMemo(() => (typeof data !== 'undefined' ? new BigNumber(data.toString()) : BIG_ZERO), [data]),
Expand Down
Expand Up @@ -31,7 +31,7 @@ export const useVeCakeUserCreditWithTime = (endTime: number): UseVeCakeUserCredi
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

const userCreditWithTime = useMemo(
() => (typeof data !== 'undefined' ? new BigNumber(data.toString()).toNumber() : 0),
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/views/CakeStaking/hooks/useVeCakeUserInfo.ts
Expand Up @@ -77,7 +77,7 @@ export const useVeCakeUserInfo = (): {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return {
data,
Expand Down
Expand Up @@ -42,7 +42,7 @@ function useIsPoolActive(pid: number) {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryClient, queryKey.toString()])
}, [blockNumber, queryClient])

return {
isActivePool: data,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/views/Farms/hooks/useFetchOraclePrice.ts
Expand Up @@ -31,7 +31,7 @@ export const useOraclePrice = (chainId?: number) => {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return price?.toString() ?? '0'
}
2 changes: 1 addition & 1 deletion apps/web/src/views/FixedStaking/hooks/useStakedPools.ts
Expand Up @@ -36,7 +36,7 @@ export function useCurrentDay(): number {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return (data || 0) as number
}
Expand Down
Expand Up @@ -50,7 +50,7 @@ export function useReadWithdrawRequestInfo():
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

const currentTime = dayjs().unix()

Expand Down
Expand Up @@ -51,7 +51,7 @@ function useChainlinkLatestRound() {
useEffect(() => {
queryClient.invalidateQueries({ queryKey })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blockNumber, queryKey.toString(), queryClient])
}, [blockNumber, queryClient])

return data
}
Expand Down

0 comments on commit 0116675

Please sign in to comment.