Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Add section about pagination to GraphQL guide#45612

Merged
philipp-spiess merged 3 commits into
mainfrom
ps/pagination-docs
Dec 14, 2022
Merged

Add section about pagination to GraphQL guide#45612
philipp-spiess merged 3 commits into
mainfrom
ps/pagination-docs

Conversation

@philipp-spiess

Copy link
Copy Markdown
Contributor

First attempt to codify some of the pagination changes in our docs.

We'll want to add a good example implementation as well later.

Thoughts? Anything that we should add?

Test plan

docs change

@philipp-spiess philipp-spiess requested review from a team, 0xnmn, eseliger and mrnugget December 13, 2022 11:58
@cla-bot cla-bot Bot added the cla-signed label Dec 13, 2022
@github-actions github-actions Bot added the team/code-exploration Issues owned by the Code Exploration team label Dec 13, 2022

@valerybugakov valerybugakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


For our GraphQL API we follow the [Relay-style connection spec](https://relay.dev/graphql/connections.htm) and cursor-based pagination.

**Cursor-based pagination** refers to a pagination API that _does not know about relative page numbers_. Instead, every API response contains a opaque _cursor_ that we can use to load the next or previous page of data. It's important that for the front-end, this _cursor_ is never introspected. It is handled as a generic `string` that is just passed from the API response directly into the next API request.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be cool to have a GraphQL snippet here that shows an example connection with this pagination.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but I wanted this snipped to be from the real app and we did not migrate the first resource just yet. Will update this as soon as we have and also add the implementation as an example for a migration 👍

@philipp-spiess philipp-spiess enabled auto-merge (squash) December 14, 2022 09:51
@philipp-spiess philipp-spiess merged commit a677bfb into main Dec 14, 2022
@philipp-spiess philipp-spiess deleted the ps/pagination-docs branch December 14, 2022 09:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/code-exploration Issues owned by the Code Exploration team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants