diff --git a/apps/web/src/hooks/useV3FarmAPI.ts b/apps/web/src/hooks/useV3FarmAPI.ts index 63119abce3b1d..b4103ab34df2f 100644 --- a/apps/web/src/hooks/useV3FarmAPI.ts +++ b/apps/web/src/hooks/useV3FarmAPI.ts @@ -6,9 +6,10 @@ import { UniversalFarmConfigV3, } from '@pancakeswap/farms' import { useQuery } from '@tanstack/react-query' +import { useMemo } from 'react' export const useV3FarmAPI = (chainId: ChainId) => { - const { data: farms } = useQuery({ + const { data } = useQuery({ queryKey: ['fetch-v3-farm-api'], queryFn: async () => { if (chainId) { @@ -23,7 +24,9 @@ export const useV3FarmAPI = (chainId: ChainId) => { refetchOnMount: false, }) + const farms = useMemo(() => data ?? [], [data]) + return { - farms: farms ?? [], + farms, } } diff --git a/apps/web/src/state/farmsV4/state/accountPositions/fetcher.ts b/apps/web/src/state/farmsV4/state/accountPositions/fetcher.ts index 46d74191d3603..394bc57a80b47 100644 --- a/apps/web/src/state/farmsV4/state/accountPositions/fetcher.ts +++ b/apps/web/src/state/farmsV4/state/accountPositions/fetcher.ts @@ -139,9 +139,8 @@ export const getAccountV2LpDetails = async ( const validLpTokens = lpTokens.filter((token) => token.chainId === chainId) const bCakeWrapperAddresses = await Promise.all( - validReserveTokens.map(async (tokens) => { - const lpAddress = getV2LiquidityToken(tokens).address - const bCakeWrapperAddress = await getBCakeWrapperAddress(lpAddress, chainId) + validLpTokens.map(async (tokens) => { + const bCakeWrapperAddress = await getBCakeWrapperAddress(tokens.address, chainId) return bCakeWrapperAddress }), )