Skip to content

Regularity of Relay opaque edge cursors in two executions of a query #3768

Answered by rmosolgo
nimmolo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! No, there's no guarantee that an object will have the same cursor in different queries. Here's why:

  • In offset-based implementations (like ArrayConnection or RelationConnect), the cursor is simply the index of the object in the list at the moment. As objects are added or removed from the list, then the index of a given object may change. In that case, the cursor would change, too. Also, if the list is sorted differently, the same object may have different indexes.
  • In GraphQL-Pro's StableRelationConnection, the cursor is a function of the order-by attributes and the object's values for those attributes. So if the object is modified such that those attributes change, or if a new query a…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@nimmolo
Comment options

@rmosolgo
Comment options

@nimmolo
Comment options

Answer selected by nimmolo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants