diff --git a/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx b/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx index 4da0386f997f..bc3048026383 100644 --- a/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx +++ b/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx @@ -243,6 +243,7 @@ export function CollectionList({ done, next: nextPage, error, + loading, retry: retryFetchCollectible, } = useNonFungibleAssets(addressName.networkSupporterPluginID, undefined, { account }) diff --git a/packages/plugin-infra/src/web3/useNonFungibleAssets.ts b/packages/plugin-infra/src/web3/useNonFungibleAssets.ts index 550ff8fafd20..7effe28cafa1 100644 --- a/packages/plugin-infra/src/web3/useNonFungibleAssets.ts +++ b/packages/plugin-infra/src/web3/useNonFungibleAssets.ts @@ -13,6 +13,7 @@ export function useNonFungibleAssets>>(EMPTY_LIST) const [done, setDone] = useState(false) + const [loading, toggleLoading] = useState(false) const [error, setError] = useState() const account = useAccount(pluginID) @@ -46,8 +47,9 @@ export function useNonFungibleAssets> = [] + toggleLoading(true) try { - for (const v of Array.from({ length: 36 })) { + for (const v of Array.from({ length: options?.size ?? 36 })) { const { value, done: iteratorDone } = await iterator.next() if (value instanceof Error) { // Controlled error @@ -68,6 +70,7 @@ export function useNonFungibleAssets [...pred, ...batchResult]) }, [iterator, done]) @@ -84,6 +87,7 @@ export function useNonFungibleAssets (options?.chainId ? x.chainId === options?.chainId : true)), next, + loading, done, retry, error,