diff --git a/packages/plugin-infra/src/web3/useNonFungibleAssets.ts b/packages/plugin-infra/src/web3/useNonFungibleAssets.ts index ae2bd59ce5ba..550ff8fafd20 100644 --- a/packages/plugin-infra/src/web3/useNonFungibleAssets.ts +++ b/packages/plugin-infra/src/web3/useNonFungibleAssets.ts @@ -22,7 +22,8 @@ export function useNonFungibleAssets { if ((!account && !options?.account) || !hub?.getNonFungibleTokens || !networks) return - + setAssets(EMPTY_LIST) + setDone(false) return flattenAsyncIterator( networks .filter((x) => x.isMainnet) @@ -39,13 +40,14 @@ export function useNonFungibleAssets { if (!iterator || done) return + const batchResult: Array> = [] try { - for (const v of Array.from({ length: 48 })) { + for (const v of Array.from({ length: 36 })) { const { value, done: iteratorDone } = await iterator.next() if (value instanceof Error) { // Controlled error @@ -57,7 +59,7 @@ export function useNonFungibleAssets [...pred, value]) + batchResult.push(value) } } } @@ -66,6 +68,7 @@ export function useNonFungibleAssets [...pred, ...batchResult]) }, [iterator, done]) // Execute once after next update @@ -74,12 +77,10 @@ export function useNonFungibleAssets { - setAssets([]) + setAssets(EMPTY_LIST) setDone(false) }, []) - useEffect(() => retry(), [options?.account ?? account, retry, options?.chainId]) - return { value: assets.filter((x) => (options?.chainId ? x.chainId === options?.chainId : true)), next,