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

feat: implement reverse paging #381

Merged
merged 9 commits into from
Feb 23, 2023
Merged

feat: implement reverse paging #381

merged 9 commits into from
Feb 23, 2023

Conversation

travis
Copy link
Member

@travis travis commented Feb 14, 2023

Use the new pre caveat and before and after cursors from storacha/w3infra#139 to implement reverse paging

reverse.paging.mov

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.
@olizilla
Copy link
Contributor

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 1, 2, 3 ... >.

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 1, 2, 3, 4, 5, 6 ... >. You can click any number and jump to that page, without a network request. If you click the arrow again, you get the next batch and now it shows < 1, 2, 3, 4, 5, 6, 7 ... 10 >, and you can page forward and backwards through them...

s3-page

I think we should keep enough state locally to implement something similar in the UI.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 16, 2023

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:

Sandbox Source
@w3ui/example-react-file-upload Configuration
@w3ui/example-react-sign-up-in Configuration
@w3ui/example-react-uploads-list Configuration
@w3ui/example-solid-file-upload Configuration
@w3ui/example-solid-sign-up-in Configuration
@w3ui/example-solid-uploads-list Configuration
@w3ui/example-vue-file-upload Configuration
@w3ui/example-vue-sign-up-in Configuration
@w3ui/example-vue-uploads-list Configuration

@travis
Copy link
Member Author

travis commented Feb 16, 2023

I think we should keep enough state locally to implement something similar in the UI.

I like this, will take a crack at it tomorrow!

@travis
Copy link
Member Author

travis commented Feb 16, 2023

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
@travis
Copy link
Member Author

travis commented Feb 17, 2023

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 1, 2, 3 ... >.

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 1, 2, 3, 4, 5, 6 ... >. You can click any number and jump to that page, without a network request. If you click the arrow again, you get the next batch and now it shows < 1, 2, 3, 4, 5, 6, 7 ... 10 >, and you can page forward and backwards through them...

s3-page s3-page

I think we should keep enough state locally to implement something similar in the UI.

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 size in the Provider, which feels awkward given that most of our providers are configured at an app level.

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?

Copy link
Member

@alanshaw alanshaw left a 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

@travis travis merged commit 10f059a into main Feb 23, 2023
@travis travis deleted the feat/pre-paging branch February 23, 2023 07:34
travis pushed a commit that referenced this pull request Feb 23, 2023
🤖 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>
travis added a commit that referenced this pull request Feb 23, 2023
🤖 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>
travis added a commit that referenced this pull request Feb 23, 2023
🤖 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>
alanshaw pushed a commit that referenced this pull request Nov 28, 2023
🤖 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>
travis pushed a commit that referenced this pull request Nov 30, 2023
🤖 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>
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.

3 participants