Skip to content

fix(graphql): nextPage and prevPage are non nullable even though they can be null sometimes #12201

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

Merged
merged 4 commits into from
May 5, 2025

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented Apr 23, 2025

This PR introduced #11952 improvement for graphql schema with making fields of the Paginated<T> interface non-nullable.

However, there are a few special ones - nextPage and prevPage. They can be null when:
The result returned 0 docs.
The result returned x docs, but in the DB we don't have x+1 doc. Thus, nextPage will be null. The result will have nextPage: null. Finally, when we query 1st page, prevPage is null as well.

image

@joefour
Copy link

joefour commented May 3, 2025

@r1tsuu @DanRibbens Hi, could we include this change for next release?

@DanRibbens DanRibbens merged commit 3fb81ef into main May 5, 2025
76 checks passed
@DanRibbens DanRibbens deleted the fix/non-nullable-grahpql branch May 5, 2025 13:12
Copy link
Contributor

github-actions bot commented May 5, 2025

🚀 This is included in version v3.37.0

kendelljoseph pushed a commit that referenced this pull request May 15, 2025
…they can be `null` sometimes (#12201)

This PR introduced #11952
improvement for graphql schema with making fields of the `Paginated<T>`
interface non-nullable.

However, there are a few special ones - `nextPage` and `prevPage`. They
can be `null` when:
The result returned 0 docs.
The result returned `x` docs, but in the DB we don't have `x+1` doc.
Thus, `nextPage` will be `null`. The result will have `nextPage: null`.
Finally, when we query 1st page, `prevPage` is `null` as well.

<img width="873" alt="image"
src="https://github.com/user-attachments/assets/04d04b13-ac26-4fc1-b421-b5f86efc9b65"
/>
kendelljoseph pushed a commit that referenced this pull request May 19, 2025
…they can be `null` sometimes (#12201)

This PR introduced #11952
improvement for graphql schema with making fields of the `Paginated<T>`
interface non-nullable.

However, there are a few special ones - `nextPage` and `prevPage`. They
can be `null` when:
The result returned 0 docs.
The result returned `x` docs, but in the DB we don't have `x+1` doc.
Thus, `nextPage` will be `null`. The result will have `nextPage: null`.
Finally, when we query 1st page, `prevPage` is `null` as well.

<img width="873" alt="image"
src="https://github.com/user-attachments/assets/04d04b13-ac26-4fc1-b421-b5f86efc9b65"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants