1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-15 17:03:30 +02:00

fix checkIsConsumable dependencies (#788)

This commit is contained in:
Matthias Kretschmann 2021-08-16 13:02:01 +03:00 committed by GitHub
parent e2bb8fc042
commit fd06afc9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,9 +30,10 @@ export default function AssetActions(): ReactElement {
const [consumableFeedback, setConsumableFeedback] = useState<string>('')
useEffect(() => {
if (!ddo || !accountId) return
if (!ddo || !accountId || !ocean || !isAssetNetwork) return
async function checkIsConsumable() {
const consumable: any = await ocean.assets.isConsumable(
const consumable = await ocean.assets.isConsumable(
ddo,
accountId.toLowerCase()
)
@ -42,11 +43,13 @@ export default function AssetActions(): ReactElement {
}
}
checkIsConsumable()
}, [accountId, ddo])
}, [accountId, isAssetNetwork, ddo, ocean])
useEffect(() => {
if (!config) return
const source = axios.CancelToken.source()
async function initFileInfo() {
setFileIsLoading(true)
try {
@ -60,11 +63,12 @@ export default function AssetActions(): ReactElement {
} catch (error) {
Logger.error(error.message)
} finally {
// this triggers a memory leak warrning, no idea how to fix
// this triggers a memory leak warning, no idea how to fix
setFileIsLoading(false)
}
}
initFileInfo()
return () => {
source.cancel()
}