Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ABW-3458] NFT page request updates #1262

Merged
merged 6 commits into from
Aug 6, 2024
Merged

Conversation

matiasbzurovski
Copy link
Contributor

@matiasbzurovski matiasbzurovski commented Aug 2, 2024

Jira ticket: ABW-3458

Description

This PR updates paging mechanism for NFTs. Our current logic was based on the assumptions that the GW would return pages with the max amount of items, and this could change in the future. In other words, if there are 100 elements to load and we were requesting pages of 29 elements, the app assumed the GW would return 4 pages with [29, 29, 29, 13] elements each. However, GW will change and the amount of pages/elements per page won't be fixed.

How to test

Play with different NFT collections and sizes to verify the loading happens correctly every time.

@@ -2,7 +2,7 @@ import Sargon

// MARK: - OnLedgerEntitiesClient + DependencyKey
extension OnLedgerEntitiesClient: DependencyKey {
public static let maximumNFTIDChunkSize = 29
public static let maximumNFTIDChunkSize = 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you are saying that GW might not return pages with the max number of items, even if there are more pages available? Didn't quite understand why this value should change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two things here:

  • This number changes to 100 because such is the value that each page can return now (and not 29 as it previously did).
  • The GW will change to potentially return less items than what it fit on one page, even if there are items to return. For example, if there are 250 items, it may return [100, 80, 70] and not [100, 100, 50] (which is what the app, without my change, currently expects and why it wouldn't work if different amount of items were returned).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the clarification

@GhenadieVP GhenadieVP merged commit b8bec88 into main Aug 6, 2024
6 checks passed
@GhenadieVP GhenadieVP deleted the ABW-3458-nft-page-updates branch August 6, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants