Skip to content

fix(useSearchParam): refresh when the parameter name changes - #2732

Open
Aminark wants to merge 2 commits into
streamich:masterfrom
Aminark:fix/search-param-name
Open

Aminark wants to merge 2 commits into
streamich:masterfrom
Aminark:fix/search-param-name

Conversation

@Aminark

@Aminark Aminark commented Oct 25, 2026

Copy link
Copy Markdown

Changing useSearchParam('foo') to useSearchParam('baz') keeps returning foo, even after a history event. The effect never updates its listener.

Refresh the value and replace the listener when param changes. Tests cover switching to another or missing parameter, plus all three history events. The four new cases fail before the fix.

  • Read the contributing guide and reviewed the diff.
  • Added regression tests; 76 suites / 496 tests pass.
  • Lint and type checks pass (97 existing lint warnings).
  • Changed hook has 100% line coverage.

Bug fix; no API changes or new documentation/Storybook examples needed.

This branch has not been deployed

No deployments
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.

1 participant