Skip to content

Implement pagination state management in URL for resource lists - #1206

Merged
gciotola merged 1 commit into
mainfrom
feat/682-persist-pagination
Aug 25, 2026
Merged

Implement pagination state management in URL for resource lists#1206
gciotola merged 1 commit into
mainfrom
feat/682-persist-pagination

Conversation

@gciotola

@gciotola gciotola commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Related to commercelayer/issues-app#682

What I did

Paginated lists now keep the current page in the query string, so coming back from
a details page reopens the page the user was on instead of page 1. Filters were
already restored; the page was the missing piece.

  • usePageInUrl reads and writes ?page=N (pushed, so the back button walks the
    pages; no parameter on page 1).
  • A resolver in useResourceList turns the requested page into one that can
    actually be served. The Core API can address any page; the Metrics API can only
    open a page whose cursor it holds, so it declines and falls back to page 1
    rather than serving page 1's rows under another page's label.
  • useMetricsCursorTrail persists the Metrics cursor trail in sessionStorage,
    so a metrics-backed list can reopen on the page it was left on.

Also included, independent of pagination and worth its own look: useResourceFilters
now replaces sdkFilters only when the filters actually change. FilteredTable is
memoized on that object, so today any query-string change remounts the whole list.

How to test

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests).
  • Make sure to add/update documentation regarding your changes.
  • You are NOT deprecating/removing a feature.

@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploy Preview for commercelayer-app-elements ready!

Name Link
🔨 Latest commit da0bba9
🔍 Latest deploy log https://app.netlify.com/projects/commercelayer-app-elements/deploys/6a8c5066304b6400084de378
😎 Deploy Preview https://deploy-preview-1206--commercelayer-app-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gciotola
gciotola marked this pull request as ready for review August 24, 2026 15:14
@gciotola gciotola self-assigned this Aug 24, 2026
@gciotola gciotola added the enhancement New feature or request label Aug 24, 2026
@gciotola
gciotola requested a review from pfferrari August 24, 2026 15:14
@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/commercelayer/app-elements/@commercelayer/app-elements@1206

commit: da0bba9

@gciotola
gciotola merged commit d560924 into main Aug 25, 2026
15 checks passed
@gciotola
gciotola deleted the feat/682-persist-pagination branch August 25, 2026 05:45
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

Successfully merging this pull request may close these issues.

2 participants