graphile / graphile/crystal

Optimization: fix unnecessary `hasNextPage` select in some circumstances

Open
#2,395 0 comments 0 reactions 0 assignees View on GitHub
✨ feature
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

This query shouldn't need a fetch for `hasNextPage` on messages connection since we can see there won't be a next page (because there's no limit):

```graphql
## expect(errors).toBeFalsy()
## expect(queries).toHaveLength(1);
{
forums(includeArchived: EXCLUSIVELY) {
name
messagesConnection(includeArchived: INHERIT) {
... @defer {
pageInfo {
hasNextPage
}
}
}
}
}
```

Similarly this non-deferred query should not contain the `array[null]` in the query where it's inlined:

```graphql
## expect(errors).toBeFalsy()
## expect(queries).toHaveLength(1);
## expect(queries[0]).not.toInclude("array[null")
{
forums(includeArchived: EXCLUSIVELY) {
name
messagesConnection(includeArchived: INHERIT) {
pageInfo {
hasNextPage
}
}
}
}
```

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.