-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix: Pagination in data browser not working #2624
base: alpha
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request!
|
Uffizzi Ephemeral Environment
|
The history of this issue is almost as infinite as the scrolling itself. We believe that the only efficient and bug-free solution would be using parse-community/parse-server#7637. Everything else has failed so far. Surely pagination is easy in an environment where data does not change, but as soon as a new record is added between page loads, a simple A few considerations:
Note I've made a small edit in the issue description; this PR seems like a temporary workaround (better buggy pagination than none?), but a true fix would require cursor based pagination, so the PR as it currently is would not close #1551. |
I think #2571 would be an alternative to allow pagination without getting into many of the issues mentioned in #2624 (comment), since only 1 page will be shown at a time. |
New Pull Request Checklist
Issue Description
Related: #1551
Approach
First issue is that the scrolling element in BrowserTable must have changed, so the scroll listener was never being fired.
Main issue really though was that the fetchNextPage code is much more complex than it needed to be. I've just used the existing state.lastMax variable to record how many records have been retrieved, and use the query.skip() function to do the pagination (as recommended in the query api documentation).
I've also added a state.fetchingNextPage variable to prevent the same fetchNextPage request being fired in quick succession. I noticed this happening during testing and it actually managed to crash my server on the bigger tables.
TODOs before merging