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

Ability to navigate to the previous page for a paged collection #66

Open
ogenodisho opened this issue Feb 3, 2022 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@ogenodisho
Copy link

The documentation for usePagedCollection contains the ability to go to the next page but it doesn't say anything about navigating to the previous page. Is this intended? Is there another way this functionality is intended to work?

@evert evert added the enhancement New feature or request label Feb 3, 2022
@evert
Copy link
Contributor

evert commented Feb 3, 2022

The way usePagedCollection works today is that it actually appends data from the next pages, facilitating 'infinite scroll' interfaces.

However, I think it might also be useful for a non-infinite-scroll pager to exist. If that hook exists, it makes perfect sense to have an option to go back an forward.

In hindsight I regret calling the hook usePagedCollection, I would have liked to have a hook named useInfiniteCollection and a separate usePagedCollection that describes the behaviour you're asking for.

@ogenodisho
Copy link
Author

In the meantime I suppose I can just handle it myself outside of ketting.

In my opinion I think usePagedCollection is fine because it's still a paged collection regardless of whether or not infinite scrolling is being used. I think it would make sense to just add some configuration to the usePagedCollection method call. Maybe something like isInfinitelyScrolling which defaults to true for backwards compatibility.

@evert
Copy link
Contributor

evert commented Feb 3, 2022

@ogenodisho yeah a flag is a good way to handle this =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants