1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

effect dependency fixes

This commit is contained in:
Matthias Kretschmann 2022-06-22 14:02:32 +01:00
parent e3b751ea8b
commit 923569e61a
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 9 additions and 12 deletions

View File

@ -490,7 +490,7 @@ export default function Compute({
<AssetActionHistoryTable title="Your Compute Jobs">
<ComputeJobs
minimal
assetChainId={[asset?.chainId]}
assetChainIds={[asset?.chainId]}
refetchJobs={refetchJobs}
/>
</AssetActionHistoryTable>

View File

@ -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<ComputeJobMetaData[]>([])
const isMounted = useIsMounted()
const newCancelToken = useCancelToken()
const [isLoading, setIsLoading] = useState(false)
const [jobs, setJobs] = useState<ComputeJobMetaData[]>([])
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 ? (
<>