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

Open
Tracked by #2331
BoD opened this issue Mar 18, 2024 · 6 comments
Open
Tracked by #2331

Pagination: merge nodes field in addition to edges #5735

BoD opened this issue Mar 18, 2024 · 6 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

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

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

@sonatard
Copy link

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 BoD self-assigned this Mar 21, 2024
@BoD BoD added ✔️ Fixed in SNAPSHOTs The fix has been merged and is available in SNAPSHOTs, and will be available in the next release ✅ Fixed in v4 labels Mar 25, 2024
@BoD BoD removed the ✔️ Fixed in SNAPSHOTs The fix has been merged and is available in SNAPSHOTs, and will be available in the next release label Apr 24, 2024
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