-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add pagination links docs #37
base: master
Are you sure you want to change the base?
docs: Add pagination links docs #37
Conversation
This is great, thanks @marcelobarreto ❤️ I really appreciate the screenshots 💯 I wonder if we can give a brief (1-2 sentence) overview of pagination links, linking to the relevant JSON:API docs. Then show how to do it globally, then how to do on-demand (and why you might want to do this). I also think the |
Yes, my bad, we don't need the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comments but great to see @marcelobarreto ❤️
{% include h.html tag="h3" text="3.4 Custom Endpoint URLs" a="custom-endpoint-urls" %} | ||
{% include h.html tag="h3" text="3.4 Pagination Links" a="pagination-links" %} | ||
|
||
Requesting big collections can result into slow responses sometimes. In order to avoid this, you could use [pagination](https://jsonapi.org/format/#fetching-pagination). It'll break your response into smaller pieces that will make your server responds faster. Paginations links can be present in your response in the following ways: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true, but rendering links is different from paginating in general. Personally I don't render the links, but I use page[size]
, page[number]
and stats[total]=count
to do the same. I think the benefit here is a little less burden on the client.
|
||
{% include h.html tag="h4" text="3.4.1 Showing by default" a="pagination-links-showing-by-default" %} | ||
|
||
With this configuration, all the responses will return the pagination links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For brevity, I would change to "Globally:"
|
||
{% include h.html tag="h4" text="3.4.2 When requested" a="pagination-links-when-requested" %} | ||
|
||
You can showing the pagination links when it was requested in the URL with `?pagination_links=true` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Or on-demand when requested in the URL with ?pagination_links=true
"
end | ||
{% endhighlight %} | ||
|
||
Pagination links won't show up for *#show* actions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this line - should already be an expectation, their presence is a bug.
Adds pagination links to the docs