Skip to content

Commit

Permalink
fix(wallet): improve fetching visual assets on higher numbered pages (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
brancoder authored Dec 26, 2024
1 parent 8d8534e commit daee547
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/wallet/src/ui/app/pages/home/nfts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ function NftsPage() {
}
}, [ownedAssets]);

useEffect(() => {
// Fetch the next page if there are no visual assets, other + hidden assets are present in multiples of 50, and there are more pages to fetch
if (
hasNextPage &&
ownedAssets?.visual.length === 0 &&
ownedAssets?.other.length + ownedAssets?.hidden.length > 0 &&
(ownedAssets.other.length + ownedAssets.hidden.length) % 50 === 0 &&
!isFetchingNextPage
) {
fetchNextPage();
setSelectedAssetCategory(null);
}
}, [hasNextPage, ownedAssets, isFetchingNextPage]);

if (isLoading) {
return (
<div className="mt-1 flex w-full justify-center">
Expand Down

0 comments on commit daee547

Please sign in to comment.