From 923569e61a77c706ee9b79c8aec09c7b3b6d077c Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 22 Jun 2022 14:02:32 +0100 Subject: [PATCH] effect dependency fixes --- .../Asset/AssetActions/Compute/index.tsx | 2 +- .../Profile/History/ComputeJobs/index.tsx | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/Asset/AssetActions/Compute/index.tsx b/src/components/Asset/AssetActions/Compute/index.tsx index 13a41bce2..2f92e358b 100644 --- a/src/components/Asset/AssetActions/Compute/index.tsx +++ b/src/components/Asset/AssetActions/Compute/index.tsx @@ -490,7 +490,7 @@ export default function Compute({ diff --git a/src/components/Profile/History/ComputeJobs/index.tsx b/src/components/Profile/History/ComputeJobs/index.tsx index 84d4aba53..d104c9f3e 100644 --- a/src/components/Profile/History/ComputeJobs/index.tsx +++ b/src/components/Profile/History/ComputeJobs/index.tsx @@ -71,20 +71,21 @@ const columns = [ export default function ComputeJobs({ minimal, - assetChainId, + assetChainIds, refetchJobs }: { minimal?: boolean - assetChainId?: number[] + assetChainIds?: number[] refetchJobs?: boolean }): ReactElement { const { accountId } = useWeb3() const { asset } = useAsset() const { chainIds } = useUserPreferences() - const [isLoading, setIsLoading] = useState(false) - const [jobs, setJobs] = useState([]) const isMounted = useIsMounted() const newCancelToken = useCancelToken() + + const [isLoading, setIsLoading] = useState(false) + const [jobs, setJobs] = useState([]) const [columnsMinimal] = useState([columns[4], columns[5], columns[3]]) const fetchJobs = useCallback(async () => { @@ -96,7 +97,7 @@ export default function ComputeJobs({ try { setIsLoading(true) const jobs = await getComputeJobs( - assetChainId || chainIds, + assetChainIds || chainIds, accountId, asset, newCancelToken() @@ -106,15 +107,11 @@ export default function ComputeJobs({ } catch (error) { LoggerInstance.error(error.message) } - }, [chainIds, accountId, asset, isMounted]) + }, [chainIds, accountId, asset, isMounted, assetChainIds, newCancelToken]) useEffect(() => { fetchJobs() - }, [fetchJobs]) - - useEffect(() => { - fetchJobs() - }, [refetchJobs]) + }, [fetchJobs, refetchJobs]) return accountId ? ( <>