Skip to content

Persist pagination state in url #2538

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

Merged
merged 11 commits into from
Apr 9, 2025
Merged

Conversation

emma-sg
Copy link
Member

@emma-sg emma-sg commented Apr 8, 2025

Closes #1944

Changes

  • Pagination stores page number in url search params, rather than internal state, allowing going back to a specific page in a list
  • Pagination navigation pushes to history stack, and listens to history changes to be able to respond to browser history navigation (back/forward)
  • Search parameter reactive controller powers pagination component
  • Pagination component allows for multiple simultaneous paginations via custom name property

Manual testing

  1. Log in as any role
  2. Go to one of the list views on an org with enough items in the list to span more than one page
  3. Click on one of the pages, and navigate back in your browser. The selected page should respect this navigation and return to the initial numbered page.
  4. Navigate forward in your browser. The selected page should respect this navigation and switch to the numbered page from the previous step.
  5. Click on a non-default page, and then click on one of the items in the list to go to its detail page. Then, using your browser's back button, return to the list page. You should be on the same numbered page as before.

@emma-sg emma-sg linked an issue Apr 8, 2025 that may be closed by this pull request
emma-sg added 6 commits April 8, 2025 02:09
was getting issues in dev where localizers were persisted in cache but garbage collected — not too sure why, but this fixes the issue, and there's only a few formatters so this shouldn't impact perf
@emma-sg emma-sg marked this pull request as ready for review April 8, 2025 21:43
@emma-sg emma-sg requested review from SuaYoo and ikreymer April 8, 2025 21:43
Co-authored-by: sua yoo <sua@suayoo.com>
@emma-sg emma-sg requested a review from SuaYoo April 9, 2025 16:58
@emma-sg emma-sg force-pushed the frontend-persist-pagination-in-url branch 2 times, most recently from bd512c2 to eb0472e Compare April 9, 2025 17:08
Copy link
Member

@SuaYoo SuaYoo left a comment

Choose a reason for hiding this comment

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

Pagination looks great. I tested with workflows, archived items, collections, collection items, and browser profiles, going backwards and forwards in browser history.

Let's cherry pick eb0472e into a separate branch though, to keep the scope of this PR (and squashed commit) to pagination?

@emma-sg emma-sg force-pushed the frontend-persist-pagination-in-url branch from eb0472e to 9ea55e9 Compare April 9, 2025 18:01
@emma-sg
Copy link
Member Author

emma-sg commented Apr 9, 2025

Yep, makes sense. Moved it to #2538, and removed from this PR.

@emma-sg emma-sg requested a review from SuaYoo April 9, 2025 18:18
@emma-sg emma-sg merged commit eeda4cd into main Apr 9, 2025
50 of 52 checks passed
@emma-sg emma-sg deleted the frontend-persist-pagination-in-url branch April 9, 2025 19:40
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.

[Feature]: Track pagination when navigating through in-app links
2 participants