fix: bring back missing artworks from collection screen #12576
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves ONYX-1862
Description
This PR fixes an issue affecting artwork grids and leading to missing artworks. After some investigation, I believe this is affecting at least 4 other screens but potentially more
What went wrong
1. Initial Query
When a user initially opens an artwork screen we load 10 artworks
2. Second Query: Pagination
When the user reaches the end, we load 15 more artworks
The way relay does both 1 and 2 is by sending a query with
first
andcursor
arguments .Inside MP, we convert
first
andcursor
to gravity supported arguments, meaningsize
,page
andoffset
.Let's break down both steps
1. Inital Query
first: 10
thencursor:null
- meaning the first 10 artworksconvertConnectionArgsToGravityArgs
giving uspage:1
andsize:10
andoffset:0
Second QueryL Pagination
first: 15
thencursor:last-artwork-cursor
- meaning the next 15 artworksconvertConnectionArgsToGravityArgs
giving uspage:2
andsize:15
andoffset:15
. BUT, becaues offset is 15! we have skipped 5 artworks since offset is computed based onfirst
.Suggested solution
Align count on initial query and next queries like we always did before here #11745.
PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.