Reflect market filters in URL and announce result counts - #968
Merged
greatest0fallt1me merged 1 commit intoOct 1, 2026
Merged
greatest0fallt1me merged 1 commit into
greatest0fallt1me merged 1 commit into
Conversation
|
@Fading-Dev is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Fading-Dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
The search and category filters on
/marketslived only in component state, so a filtered viewcould not be shared, bookmarked or restored with the Back button, and the FWC26 campaign links lost
their filter context. Nothing announced the filtered result count to screen-reader users.
Both filters now round-trip through the query string — debounced so typing writes one history entry
per pause rather than one per keystroke — the state hydrates from the URL on load with category
validated against the known list, and each change in result count produces a single polite
live-region announcement through the existing
useGlobalLiveRegionhook.Related Issue
Closes #965
Changes
URL as the source of truth
app/markets/page.tsxuseSearchParams()now hydratessearchandcategoryon mount, so/markets?q=argentina&category=Footballpre-fills both controls and filters the list.categoryfalls back toallvia anisKnownCategoryguard instead offiltering to an empty grid.
router.replace(notpush) writes?q=/?category=after a 300 ms debounce, so a typingsession does not add a history entry per keystroke and Back leaves the filtered view intact.
React.Suspenseboundary, whichuseSearchParams()opts theroute into, so the shell still prerenders.
Announcements
app/markets/page.tsxN markets foundpolitely throughuseGlobalLiveRegion()after filtering,deduplicating identical counts so re-renders do not repeat the message.
NoMatchEmptyState's clear action resets both the component state and the URL.Tests
app/markets/__tests__/page.test.tsxreplacewrite, the announcement payload and the clear-button reset.
Verification Results
?q=in the URL without adding a history entry per keystrokerouter.replace/markets?q=argentina&category=Footballpre-fills both controls and filters the listuseSearchParams()allisKnownCategoryguard against theCATEGORIESlistuseGlobalLiveRegion()with duplicate-count suppressionapp/markets/__tests__/page.test.tsxcovers URL hydration and the announcementCloses #965