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"> <AssetActionHistoryTable title="Your Compute Jobs">
<ComputeJobs <ComputeJobs
minimal minimal
assetChainId={[asset?.chainId]} assetChainIds={[asset?.chainId]}
refetchJobs={refetchJobs} refetchJobs={refetchJobs}
/> />
</AssetActionHistoryTable> </AssetActionHistoryTable>

View File

@ -71,20 +71,21 @@ const columns = [
export default function ComputeJobs({ export default function ComputeJobs({
minimal, minimal,
assetChainId, assetChainIds,
refetchJobs refetchJobs
}: { }: {
minimal?: boolean minimal?: boolean
assetChainId?: number[] assetChainIds?: number[]
refetchJobs?: boolean refetchJobs?: boolean
}): ReactElement { }): ReactElement {
const { accountId } = useWeb3() const { accountId } = useWeb3()
const { asset } = useAsset() const { asset } = useAsset()
const { chainIds } = useUserPreferences() const { chainIds } = useUserPreferences()
const [isLoading, setIsLoading] = useState(false)
const [jobs, setJobs] = useState<ComputeJobMetaData[]>([])
const isMounted = useIsMounted() const isMounted = useIsMounted()
const newCancelToken = useCancelToken() const newCancelToken = useCancelToken()
const [isLoading, setIsLoading] = useState(false)
const [jobs, setJobs] = useState<ComputeJobMetaData[]>([])
const [columnsMinimal] = useState([columns[4], columns[5], columns[3]]) const [columnsMinimal] = useState([columns[4], columns[5], columns[3]])
const fetchJobs = useCallback(async () => { const fetchJobs = useCallback(async () => {
@ -96,7 +97,7 @@ export default function ComputeJobs({
try { try {
setIsLoading(true) setIsLoading(true)
const jobs = await getComputeJobs( const jobs = await getComputeJobs(
assetChainId || chainIds, assetChainIds || chainIds,
accountId, accountId,
asset, asset,
newCancelToken() newCancelToken()
@ -106,15 +107,11 @@ export default function ComputeJobs({
} catch (error) { } catch (error) {
LoggerInstance.error(error.message) LoggerInstance.error(error.message)
} }
}, [chainIds, accountId, asset, isMounted]) }, [chainIds, accountId, asset, isMounted, assetChainIds, newCancelToken])
useEffect(() => { useEffect(() => {
fetchJobs() fetchJobs()
}, [fetchJobs]) }, [fetchJobs, refetchJobs])
useEffect(() => {
fetchJobs()
}, [refetchJobs])
return accountId ? ( return accountId ? (
<> <>