Skip to content

Optimization: fix unnecessary hasNextPage select in some circumstances #2395

@benjie

Description

@benjie

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):

## 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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🌳 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions