From b78adb88b526f94d4b8cd75f498b1895f37e8b33 Mon Sep 17 00:00:00 2001 From: memoyil <2213635+memoyil@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:08:43 +0100 Subject: [PATCH] chore: Use same loading indicator for lp positions --- .../accountPositions/hooks/useAccountStableLpDetails.ts | 4 ++-- .../state/accountPositions/hooks/useAccountV2LpDetails.ts | 6 +++--- .../state/accountPositions/hooks/useAccountV3Positions.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountStableLpDetails.ts b/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountStableLpDetails.ts index a2d2522aa5347..93d2da4f0283b 100644 --- a/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountStableLpDetails.ts +++ b/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountStableLpDetails.ts @@ -10,7 +10,7 @@ import { useLatestTxReceipt } from './useLatestTxReceipt' export const useAccountStableLpDetails = (chainIds: number[], account?: Address | null) => { const [latestTxReceipt] = useLatestTxReceipt() - const { data, isPending } = useQuery({ + const { data, isPending, isLoading } = useQuery({ queryKey: ['accountStableLpBalance', account, chainIds.join(','), latestTxReceipt?.blockHash], // @todo @ChefJerry add signal queryFn: async () => { @@ -42,7 +42,7 @@ export const useAccountStableLpDetails = (chainIds: number[], account?: Address return useMemo( () => ({ data: data ?? [], - pending: isPending, + pending: isPending || isLoading, }), [data, isPending], ) diff --git a/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV2LpDetails.ts b/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV2LpDetails.ts index e4f0882abc1f0..816c313cc01eb 100644 --- a/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV2LpDetails.ts +++ b/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV2LpDetails.ts @@ -44,7 +44,7 @@ export const useAccountV2LpDetails = (chainIds: number[], account?: Address | nu const [latestTxReceipt] = useLatestTxReceipt() - const { data, isFetching, isLoading } = useQuery({ + const { data, isPending, isLoading } = useQuery({ queryKey: ['accountV2LpDetails', account, chainIds.join('-'), totalTokenPairCount, latestTxReceipt?.blockHash], queryFn: async () => { if (!account || !lpTokensByChain) return [] @@ -73,8 +73,8 @@ export const useAccountV2LpDetails = (chainIds: number[], account?: Address | nu return useMemo( () => ({ data: data ?? [], - pending: isLoading || isFetching, + pending: isLoading || isPending, }), - [data, isLoading, isFetching], + [data, isLoading, isPending], ) } diff --git a/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV3Positions.ts b/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV3Positions.ts index 266c281c77957..13342214016bf 100644 --- a/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV3Positions.ts +++ b/apps/web/src/state/farmsV4/state/accountPositions/hooks/useAccountV3Positions.ts @@ -9,7 +9,7 @@ import { useLatestTxReceipt } from './useLatestTxReceipt' export const useAccountV3Positions = (chainIds: number[], account?: Address | null) => { const [latestTxReceipt] = useLatestTxReceipt() - const { data, isPending } = useQuery({ + const { data, isPending, isLoading } = useQuery({ queryKey: ['accountV3Positions', account, chainIds.join('-'), latestTxReceipt?.blockHash], // @todo @ChefJerry add signal queryFn: async () => { @@ -39,7 +39,7 @@ export const useAccountV3Positions = (chainIds: number[], account?: Address | nu return useMemo( () => ({ data: data ?? [], - pending: isPending, + pending: isPending || isLoading, }), [data, isPending], )