mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fix checkIsConsumable dependencies (#788)
This commit is contained in:
parent
e2bb8fc042
commit
fd06afc9f8
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user