-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: implement reverse paging #381
Conversation
Use the new `pre` caveat and `startCursor` and `endCursor` from storacha/w3infra#139 to implement reverse paging. One unsatisfying issue with this is that paging backwards reverses the order of items in the uploads list, and that edge conditions behave fairly confusingly. Not entirely sure what to do about this yet, so pushing up for some feedback. This currently only works with a bunch of custom service config and `file:/` dependencies that I am not pushing up for now.
The aws s3 ui fake pagination is a good example here. It shows large pages of ~300 items, so new users don't have to think about paging at all, and in practice it loads 900 items immediately, and then shows the user Clicking between 1,2,3 loads that "page" from local state. Clicking on the arrow fetches the next 900, divided over another 3 pages, showing I think we should keep enough state locally to implement something similar in the UI. |
this brings in the necessary changes for reverse paging
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1f928a4:
|
I like this, will take a crack at it tomorrow! |
this PR should be testable by others now - the upload-api changes it depends on are now in production |
- use icons instead of word buttons - make edge cases seem less weird by not rendering 0 sized pages
OK so - this is definitely doable, but will take a bit of work because we currently store state all the way up in the UploadsListProvider. I have already had an itch to redesign how state management here works, because in the current implementation we have to set page I think that generally we should separate uploads list state from the code that provides uploads list API functions so that the API can be added at the app level and individual upload list state can be provided closer to where the uploads list is rendered. This will also be a good opportunity to ensure we can implement the "fake paging" pattern you describe here more easily. I'd like to move this redesign to a separate task if you don't mind, so that it can be prioritized and implemented separately - what we have here is already an improvement and should work pretty well for most users today, and I'd like to move on to other tasks for now - happy to file an issue to make sure we don't lose track of it - @olizilla what do you think? |
per change in storacha/w3infra#148
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.
LGTM, please fix the CI
🤖 I have created a release *beep* *boop* --- ## [4.1.0](uploader-core-v4.0.0...uploader-core-v4.1.0) (2023-02-23) ### Features * implement reverse paging ([#381](#381)) ([10f059a](10f059a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [2.1.0](uploads-list-core-v2.0.1...uploads-list-core-v2.1.0) (2023-02-23) ### Features * implement reverse paging ([#381](#381)) ([10f059a](10f059a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Travis Vachon <travis@dag.house>
🤖 I have created a release *beep* *boop* --- ## [2.2.0](react-uploads-list-v2.1.0...react-uploads-list-v2.2.0) (2023-02-23) ### Features * implement reverse paging ([#381](#381)) ([10f059a](10f059a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Travis Vachon <travis@dag.house>
🤖 I have created a release *beep* *boop* --- ## 1.0.0 (2023-11-28) ### Features * adds space-finder autocomplete combobox ([#268](#268)) ([3dcd647](3dcd647)) * allow users to set page size in W3APIProvider ([#308](#308)) ([814a293](814a293)) * club tropical w3 auth boxen ([#350](#350)) ([2266eb2](2266eb2)) * Customizable UI components ([#208](#208)) ([0a776fe](0a776fe)) * implement reverse paging ([#381](#381)) ([10f059a](10f059a)) * Improve upload component flow ([#285](#285)) ([ba9a3bf](ba9a3bf)) * simplify ([#591](#591)) ([d1dfdf0](d1dfdf0)) * Storybook story improvements ([#294](#294)) ([e0de2cc](e0de2cc)) ### Bug Fixes * fix w3console styling ([#320](#320)) ([74a298c](74a298c)) * remove authenticator class when registed ([#352](#352)) ([3668f3b](3668f3b)) * w3console polish ([#284](#284)) ([9a67365](9a67365)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
🤖 I have created a release *beep* *boop* --- ## [1.2.0](react-v1.1.1...react-v1.2.0) (2023-11-30) ### Features * add a logout function ([#595](#595)) ([0995fd5](0995fd5)) * adds space-finder autocomplete combobox ([#268](#268)) ([3dcd647](3dcd647)) * allow users to set page size in W3APIProvider ([#308](#308)) ([814a293](814a293)) * club tropical w3 auth boxen ([#350](#350)) ([2266eb2](2266eb2)) * Customizable UI components ([#208](#208)) ([0a776fe](0a776fe)) * implement reverse paging ([#381](#381)) ([10f059a](10f059a)) * Improve upload component flow ([#285](#285)) ([ba9a3bf](ba9a3bf)) * simplify ([#591](#591)) ([d1dfdf0](d1dfdf0)) * Storybook story improvements ([#294](#294)) ([e0de2cc](e0de2cc)) ### Bug Fixes * fix w3console styling ([#320](#320)) ([74a298c](74a298c)) * homepage URL in package.json ([1229119](1229119)) * remove authenticator class when registed ([#352](#352)) ([3668f3b](3668f3b)) * w3console polish ([#284](#284)) ([9a67365](9a67365)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Use the new
pre
caveat andbefore
andafter
cursors from storacha/w3infra#139 to implement reverse pagingreverse.paging.mov