diff --git a/src/pages/Pools/hooks/hooks.ts b/src/pages/Pools/hooks/hooks.ts index 3e2191d69..96a4747b8 100644 --- a/src/pages/Pools/hooks/hooks.ts +++ b/src/pages/Pools/hooks/hooks.ts @@ -271,7 +271,7 @@ export const useGetRewardInfo = ({ stakerAddr, poolInfo }: RewardInfoQueryType) const { data: totalRewardInfoData, refetch: refetchRewardInfo } = useQuery( ['reward-info', stakerAddr, poolInfo], () => fetchRewardInfoV3(stakerAddr, poolInfo?.liquidityAddr), - { enabled: !!stakerAddr, refetchOnWindowFocus: true } + { enabled: !!stakerAddr, refetchOnWindowFocus: false } ); return { totalRewardInfoData, refetchRewardInfo }; @@ -308,7 +308,7 @@ export const getStatisticData = (data: PoolInfoResponse[]) => { }; export const getClaimableInfoByPool = ({ pool, totalRewardInfoData }) => { - const rewardPerSecInfoData = JSON.parse(pool.rewardPerSec); + const rewardPerSecInfoData = JSON.parse(pool.rewardPerSec ?? '{}'); const currentPoolReward = totalRewardInfoData?.reward_infos?.find((reward) => isEqual(reward.staking_token, pool.liquidityAddr) diff --git a/src/pages/Pools/index.tsx b/src/pages/Pools/index.tsx index 15f39cdb1..d41168713 100644 --- a/src/pages/Pools/index.tsx +++ b/src/pages/Pools/index.tsx @@ -3,7 +3,7 @@ import { isMobile } from '@walletconnect/browser-utils'; import useConfigReducer from 'hooks/useConfigReducer'; import useTheme from 'hooks/useTheme'; import isEqual from 'lodash/isEqual'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { PoolInfoResponse } from 'types/pool'; import NewTokenModal from './NewTokenModal/NewTokenModal'; import { Filter } from './components/Filter'; @@ -171,9 +171,9 @@ const Pools: React.FC<{}> = () => {