Skip to content

Commit

Permalink
Fix loading and type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mcayuelas-ledger committed Jan 29, 2024
1 parent d6ee9eb commit ec512f6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
28 changes: 17 additions & 11 deletions apps/ledger-live-mobile/src/components/Nft/NftGallery/NftList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,28 @@ const NftList = ({ data, hasNextPage, fetchNextPage, isLoading }: Props) => {
marginBottom: multiSelectModeEnabled ? 0 : space[3],
}}
ListFooterComponent={
hasNextPage ? (
!isLoading && hasNextPage ? (
<Flex paddingBottom={25} paddingTop={25}>
<InfiniteLoader />
<InfiniteLoader color="yellow" />
</Flex>
) : null
}
ListEmptyComponent={
<EmptyState
onPress={() => {
track("button_clicked", {
button: "Reset Filters",
page: ScreenName.WalletNftGallery,
});
openFilterDrawer();
}}
/>
isLoading ? (
<Flex flexGrow={1} justifyContent="center" paddingBottom={150}>
<InfiniteLoader />
</Flex>
) : (
<EmptyState
onPress={() => {
track("button_clicked", {
button: "Reset Filters",
page: ScreenName.WalletNftGallery,
});
openFilterDrawer();
}}
/>
)
}
data={data.length > 0 ? dataWithAdd : data}
renderItem={renderItem}
Expand Down
17 changes: 9 additions & 8 deletions apps/ledger-live-mobile/src/hooks/useNftGallery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ export function useNftGallery({ addresses, nftsOwned, chains }: HookProps) {

return {
...queryResult,
nfts: queryResult.data?.pages
.flatMap(x => x?.whiteList || [])
.map(elem =>
nftsWithProperties.get(
encodeNftId("", elem.contract ?? "", elem.tokenId ?? "", elem.currencyId ?? ""),
),
)
.filter(Boolean) as ProtoNFT[],
nfts:
(queryResult.data?.pages
.flatMap(x => x?.whiteList || [])
.map(elem =>
nftsWithProperties.get(
encodeNftId("", elem.contract ?? "", elem.tokenId ?? "", elem.currencyId ?? ""),
),
)
.filter(Boolean) as ProtoNFT[]) || [],
};
}

0 comments on commit ec512f6

Please sign in to comment.