Skip to content

Document behavior when both first and last are specified for pagination #1055

Closed
@cocet33000

Description

@cocet33000

Hello! I have a question about GraphQL cursor-based pagination.

Current situation

  • When both first and last are specified, first seems to take priority
  • This behavior isn't documented anywhere (?)

Request

query {
  items(
    first: 6
    after: "T18z"
    last: 2
    before: "T185"
  ){
    edges {
      node {
        id
      }
    }
  }
}

※ T18z (O_3), T185 (O_9)

ScrollSubrange Object at Controller

image
Implicitly first and afeter values are selected

Issues

  1. Potential confusion for client
  2. May lead to unintended results
  3. Differs from common GraphQL practices

What I've checked

I've looked through official docs, source code, and forums, but found no explanation of this behavior. If I've missed any information, please let me know!

Suggestions

  1. Prohibit simultaneous use
  2. Clearly document the behavior
  3. Implement a warning system

Points for discussion

  1. Is this behavior intentional?
  2. Should we align with common GraphQL practices?
  3. What would be the impact of changing this?

I'd love to hear your thoughts and ideas!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions