Skip to content

Conversation

@chanceaclark
Copy link
Contributor

What/Why?

When the sort option is changed in the product filter, the before/after pagination query params are now removed. This prevents stale pagination cursors from being used with the new sort order, which could lead to incorrect results or empty pages.

Changes:

  • Updated Sorting component to use useQueryStates instead of useQueryState
  • Now manages sort, before, and after params together
  • Clears before and after params when sort value changes

Testing

Screen.Recording.2026-01-06.at.14.21.21.mov

Migration

Change the import from useQueryState to useQueryStates, update the state management to const [params, setParams] = useQueryStates({ [paramName]: parseAsString.withDefault(defaultValue), before: parseAsString, after: parseAsString }, { shallow: false, history: 'push' }), change the optimistic state to use params[paramName], and update the onValueChange handler to call setParams({ [paramName]: value, before: null, after: null }) instead of setParam(value). If you haven't customized this file, simply pulling the changes will work without any additional action.

@chanceaclark chanceaclark requested a review from a team as a code owner January 6, 2026 21:32
@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: 837be7c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
catalyst Ready Ready Preview, Comment Jan 6, 2026 9:40pm

When the sort option is changed in the product filter, the before/after
pagination query params are now removed. This prevents stale pagination
cursors from being used with the new sort order, which could lead to
incorrect results or empty pages.

Changes:
- Updated Sorting component to use useQueryStates instead of useQueryState
- Now manages sort, before, and after params together
- Clears before and after params when sort value changes
@chanceaclark chanceaclark added this pull request to the merge queue Jan 6, 2026
Merged via the queue into canary with commit b57bffa Jan 6, 2026
8 checks passed
@chanceaclark chanceaclark deleted the claude/clear-filter-on-sort-Pd5t4 branch January 6, 2026 21:58
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.

5 participants