Skip to content
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

Adding cursor pagination. Fixes #2155 #2173

Merged
merged 5 commits into from
Oct 6, 2023
Merged

Conversation

dessalines
Copy link
Member

Description

Adds cursor pagination by adding a pageCursor in place of page in the home and community urls.

Since the API doesn't return a previous_cursor, I had to use the back button for a previous, but it works well.

This breaks next page comment pagination (the first page shows fine), but we should probably do away with those at some point anyway.

Comment on lines 37 to 45
handlePrev(i: PaginatorCursor) {
i.props.onPrev();
}

handleNext(i: PaginatorCursor) {
if (i.props.nextPage) {
i.props.onNext(i.props.nextPage);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: these can be declared as regular functions instead of class methods since you are using linkEvent.

prevPage?: PaginationCursor;
nextPage?: PaginationCursor;
onNext(val: PaginationCursor): any;
onPrev(): any;
Copy link
Member

Choose a reason for hiding this comment

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

We don't use what gets returned from this (if anything), so it could just return void.

interface PaginatorCursorProps {
prevPage?: PaginationCursor;
nextPage?: PaginationCursor;
onNext(val: PaginationCursor): any;
Copy link
Member

Choose a reason for hiding this comment

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

Do we use the return value for this? If not, we could make this return void as well.

@SleeplessOne1917 SleeplessOne1917 enabled auto-merge (squash) October 6, 2023 13:07
@SleeplessOne1917 SleeplessOne1917 merged commit 2c1f453 into main Oct 6, 2023
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants