facebook / facebook/relay

Nested pagination issue

Open
#2,224 2 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Currently having an issue with the relay approach to nested pagination. An example below to illustrate what I mean:
```
{
"data": {
"locations": {
"edges": [
{
"node": {
"id": "Location_254"
}
},
{
"node": {
"id": "Location_247"
}
},
{
"node": {
"id": "Location_217"
}
},
]
}
}
```

Here I have 3 locations returned from a query. Now I wanted to paginate on these locations and look at their 'history'.

```
query {
locations {
edges {
node {
history(
first:10
after:"eyJzbm9vemVJZCI6Mzg3fQ=="
)
}
}
}
}
```

This would paginate 10 results after the specified cursor. My issue is, is that this cursor is specific to the location it was obtained from. The cursor it is referring to paginate after, only applies to the location it came from.

Nested pagination tries to paginate on ALL locations here, when in actuality, the cursor being used, was grabbed from a specific location.

Am I seeing this incorrectly, or is there a better way I could be approaching this issue?

Regards, Sebastian

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.