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

Add page info field to connection object #1177

Merged
merged 7 commits into from
Nov 19, 2023
Merged

Conversation

JunichiSugiura
Copy link
Contributor

@JunichiSugiura JunichiSugiura commented Nov 10, 2023

This PR adds pageInfo fields in all connection object exposed by Torii in order to enable server side pagination.

@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from ef9a59d to dc0f611 Compare November 10, 2023 14:34
@JunichiSugiura
Copy link
Contributor Author

JunichiSugiura commented Nov 10, 2023

References

@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from c496499 to e30ec7e Compare November 15, 2023 11:52
@JunichiSugiura JunichiSugiura marked this pull request as draft November 15, 2023 12:00
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from 5377830 to 5ffcdd1 Compare November 16, 2023 10:53
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from 5ffcdd1 to 8c6c2e6 Compare November 16, 2023 11:07
@JunichiSugiura JunichiSugiura marked this pull request as ready for review November 17, 2023 16:39
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from a93ded8 to 9ff024a Compare November 17, 2023 16:45
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from 9ff024a to aa6824f Compare November 17, 2023 16:46
@broody
Copy link
Collaborator

broody commented Nov 17, 2023

#ikuzooo

Do you mind adding optional page_info member and simple test case for cursor based pagination?

pub struct Connection<T> {

@JunichiSugiura
Copy link
Contributor Author

@broody How can I return Null for nested object?

Current error

Screenshot 2023-11-18 at 16 29 24

Because I'm returning Value::Null here I think.

Copy link
Collaborator

@broody broody left a comment

Choose a reason for hiding this comment

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

@broody How can I return Null for nested object?

Ah this is an issue, in the schema, nested objects are by default nullable but then we reject null values. I'll fix this, but for page_info I think we do want a non-null value object.

crates/torii/graphql/src/object/connection/mod.rs Outdated Show resolved Hide resolved
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch 2 times, most recently from 2ff6fd4 to bd686ee Compare November 19, 2023 12:42
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch 2 times, most recently from fc4f0b5 to 99a60bb Compare November 19, 2023 13:13
@JunichiSugiura JunichiSugiura force-pushed the feat(torii)/graphql-page-info branch from 99a60bb to 7c3e13c Compare November 19, 2023 13:24
@broody broody merged commit 9996919 into main Nov 19, 2023
12 checks passed
@broody broody deleted the feat(torii)/graphql-page-info branch November 19, 2023 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants