hasura / hasura/graphql-engine
[v2.0] Relay after argument not working for custom functions
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
Related #5658
Relay `after` argument not working in `v2.0`.
## Repro
Take a custom function and run:
```graphql
query MyQuery {
my_custom_function_connection(args: {seed: "0.5"}, first: 2) {
edges {
node {
id
pk
}
cursor
}
}
}
```
The response will be something like this:
```json
{
"data": {
"my_custom_function_connection": {
"edges": [
{
"node": {
"id": "WzEsICJwdWJsaWMiLCAid29kIiwgNDJd",
"pk": 42
},
"cursor": "eyJwayIgOiA0Mn0="
},
{
"node": {
"id": "WzEsICJwdWJsaWMiLCAid29kIiwgMzFd",
"pk": 31
},
"cursor": "eyJwayIgOiAzMX0="
}
]
}
}
}
```
Now, do one more query, with the `after` argument being the `cursor` of the first node:
```graphql
query MyQuery {
my_custom_function_connection(args: {seed: "0.5"}, first: 2, after: "eyJwayIgOiA0Mn0=") {
edges {
node {
id
pk
}
cursor
}
}
}
```
received:
```json
{
"data": {
"my_custom_function_connection": {
"edges": [
{
"node": {
"id": "WzEsICJwdWJsaWMiLCAid29kIiwgNTNd", expected "WzEsICJwdWJsaWMiLCAid29kIiwgMzFd"
"pk": 53 expected 31
},
"cursor": "eyJwayIgOiA1M30="
},
{
"node": {
"id": "WzEsICJwdWJsaWMiLCAid29kIiwgNDVd",
"pk": 45
},
"cursor": "eyJwayIgOiA0NX0="
}
]
}
}
}
```
Expected the first node in the second query to be the same as the second node in the first query. But it wasn't.
Contributor guide
Research direction
Start by running the two GraphQL queries in the reproduction against a custom function connection and compare the returned cursors and nodes. Trace how the connection handles the Relay `after` cursor for custom functions. Done means the second query begins with the first query's second node, as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100