diff --git a/src/state/farms/elasticv2/updater.tsx b/src/state/farms/elasticv2/updater.tsx index 643de26358..f8b893e5ca 100644 --- a/src/state/farms/elasticv2/updater.tsx +++ b/src/state/farms/elasticv2/updater.tsx @@ -136,9 +136,11 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b if (isEnableKNProtocol) return knProtocolError return subgraphError }, [isEnableKNProtocol, subgraphError, knProtocolError]) + const isLoadingElasticFarm = useRef(elasticFarm.loading) + isLoadingElasticFarm.current = elasticFarm.loading useEffect(() => { - if (isEVM && !elasticFarm?.farms && !elasticFarm?.loading) { + if (isEVM && !elasticFarm?.farms && !isLoadingElasticFarm.current) { dispatch(setLoading({ chainId, loading: true })) if (isEnableKNProtocol) { getElasticFarmV2FromKnProtocol(chainId).finally(() => { @@ -149,7 +151,15 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b dispatch(setLoading({ chainId, loading: false })) }) } - }, [isEVM, chainId, dispatch, getElasticFarmV2, elasticFarm, getElasticFarmV2FromKnProtocol, isEnableKNProtocol]) + }, [ + isEVM, + chainId, + dispatch, + getElasticFarmV2, + elasticFarm?.farms, + getElasticFarmV2FromKnProtocol, + isEnableKNProtocol, + ]) useEffect(() => { const i = interval