Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Warn about importance of ordering for all pagination classes #8494

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

Open
Elkasitu wants to merge 2 commits into encode:main
base: main
Choose a base branch
Loading
from Elkasitu:improve-pagination-documentation

Conversation

@Elkasitu
Copy link

@Elkasitu Elkasitu commented May 20, 2022

The ordering recommendations given for the CursorPagination scheme
actually apply to all pagination schemes, an unsuspecting developer that
implements the more common LimitOffsetPagination or
PageNumberPagination classes is unlikely to be aware of the importance
of consistent ordering.

This commit moves the Details and limitations section out of the
CursorPagination section and puts it as the very first subsection of
the Pagination page so that it's one of the first things that
developers see.

Some examples of inconsistencies as well as how to deal with them are
given, and an extra way to change the ordering of a paginated view is
provided.

Fixes #6886

Hopefully this will prevent future developers from scratching their head and wondering why despite a view returning a count of X, going through all the pages yields Y records.

The ordering recommendations given for the CursorPagination scheme
actually apply to all pagination schemes, an unsuspecting developer that
implements the more common `LimitOffsetPagination` or
`PageNumberPagination` classes is unlikely to be aware of the importance
of consistent ordering.
This commit moves the `Details and limitations` section out of the
`CursorPagination` section and puts it as the very first subsection of
the `Pagination` page so that it's one of the first things that
developers see.
Some examples of inconsistencies as well as how to deal with them are
given, and an extra way to change the ordering of a paginated view is
provided.
Fixes encode#6886 
Copy link
Contributor

I'm not convinced that this section makes sense when moved around like this.

For example from a first look over - it discusses the ordering attribute on the pagination class. Which is specific to the CursorPagination class, rather than being generally applicable.

Copy link
Author

Elkasitu commented Jun 6, 2022

You're right, when I wrote this patch I hadn't actually tried to implement CursorPagination yet so I assumed some of these things also applied to the other Pagination classes (like an interface).

I have made some changes, I kept it as a general section because the only Pagination class that is really different from the others is CursorPagination, so having a subsection per class seemed like a lot of duplicated text.

Copy link

Segue sempre sem fazer nenhuma alteração

Copy link

stale bot commented Aug 11, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 11, 2022
Copy link
Author

Elkasitu commented Aug 14, 2022
edited
Loading

@tomchristie any chance of ever getting something like this merged? I feel like it's an easy and dangerous trap to fall into

@stale stale bot removed the stale label Aug 14, 2022
Copy link
Collaborator

auvipy commented Nov 22, 2022

@tomchristie any chance of ever getting something like this merged? I feel like it's an easy and dangerous trap to fall into

did you addressed the concerns @tomchristie initially raised?

Copy link
Author

@auvipy Well there was only one concern which was about the ordering attribute of the CursorPagination class which I did address, you can see the changes I made in the second commit (can be squashed).

If there are any other concerns I'm willing to address them too


If the main field that you wish to order by does not satisfy these conditions, you can order by multiple fields, as long as one of the fields fulfills all of the conditions above the result set should remain consistent across database calls.

# inconsistent
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to include for elaborate code example here including the pagination classes

Copy link

stale bot commented May 6, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 6, 2025
Copy link
Contributor

ulgens commented May 6, 2025

Still looks relevant.

browniebroke reacted with thumbs up emoji

@stale stale bot removed the stale label May 6, 2025
Copy link

stale bot commented Oct 18, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@auvipy auvipy auvipy requested changes

+2 more reviewers

@Faki-140386 Faki-140386 Faki-140386 approved these changes

@blockchainGuru1018 blockchainGuru1018 blockchainGuru1018 approved these changes

Reviewers whose approvals may not affect merge requirements

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Missing/duplicate records when using ordering and LimitOffsetPagination

AltStyle によって変換されたページ (->オリジナル) /