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

Pagination: merge nodes field in addition to edges #5735

Closed
Tracked by #2331
BoD opened this issue Mar 18, 2024 · 8 comments
Closed
Tracked by #2331

Pagination: merge nodes field in addition to edges #5735

BoD opened this issue Mar 18, 2024 · 8 comments

Comments

@BoD
Copy link
Contributor

BoD commented Mar 18, 2024

Currently it is possible to configure the (incubating) pagination system to handle Relay-style pagination by using @TypePolicy(connectionFields: ...) and ConnectionFieldMerger.

This will automatically merge the lists in edges into a single record, allowing the app code to watch it and update the UI.

In addition to the edges field, it is common for schemas to also have a nodes field (e.g. the GitHub and Shopify schemas), which simplifies a bit the usage of the API. ConnectionFieldMerger could handle this by merging nodes in addition to edges, if present.

Original question about this here.

@martinbonnin
Copy link
Contributor

Is there? (Or can we add?) an existing pull request or proposal to add this to the Relay specification? Would be rad to add this but having some proposal before doing the implementation would be even rad-er!

@sonatard
Copy link
Contributor

sonatard commented Mar 19, 2024

I also hope that Nodes will be reflected in the Relay specification.

In the Relay specification, Edge cursors are not used, but even so, this is in the Note format and does not fundamentally address the issue.
https://github.com/facebook/relay/blob/12965cec6b239ae9f020a4c97c1e8a00c6da5248/website/spec/Connections.md?plain=1#L377-L381

Additionally, the terms "Relay Classic", "Relay Legacy", and "Relay Modern" appear in the Relay specification, but we do not understand what each of them refers to.

@martinbonnin
Copy link
Contributor

@sonatard do you want to open an issue in the Relay repo and we can follow up with the Relay team to clarify the terms and explore the possible addition of nodes?

@sonatard
Copy link
Contributor

Thank you for the suggestion. I plan to open two issues.

@sonatard
Copy link
Contributor

Create a following issue
facebook/relay#4653

And I had actually created an issue about nodes in the past. I had forgotten about it until today.
facebook/relay#3850

@martinbonnin
Copy link
Contributor

Good find! upvoted!

@BoD
Copy link
Contributor Author

BoD commented Jun 14, 2024

Closing now as this is available in the incubating caching artifact. Don't hesitate to open tickets for comments/issues with this.

@BoD BoD closed this as completed Jun 14, 2024
Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Kotlin usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants