Skip to content

feat: add useAllSearchParam hook - #2720

Closed
bosi-programming wants to merge 1 commit into
streamich:masterfrom
bosi-programming:kepler/2390-task-2101db2c
Closed

bosi-programming wants to merge 1 commit into
streamich:masterfrom
bosi-programming:kepler/2390-task-2101db2c

Conversation

@bosi-programming

Copy link
Copy Markdown

Adds a useAllSearchParam sensor hook that returns every URL search param as an object, so consumers don't need to instantiate useSearchParam once per param.

Closes #2390.

Changes

  • src/useAllSearchParam.ts β€” new hook returning Record<string, string>; watches popstate/pushstate/replacestate; server fallback returns {}.
  • tests/useAllSearchParam.test.ts β€” covers all params, empty search, updates, duplicate keys.
  • src/index.ts β€” exports the hook.
  • stories/useAllSearchParam.story.tsx, docs/useAllSearchParam.md, README.md β€” docs and demo.

Semantics

  • Single value per key: a repeated param keeps its first value (?foo=bar&foo=baz β†’ { foo: 'bar' }), matching useSearchParam's .get() behavior.

Verification

  • yarn test β€” 77 suites / 496 tests pass.
  • yarn lint β€” 0 errors.
  • yarn lint:types β€” clean.

@bosi-programming
bosi-programming deleted the kepler/2390-task-2101db2c branch September 22, 2026 19:24
@bosi-programming

Copy link
Copy Markdown
Author

Superseded by #2721 (branch renamed to pr/use-all-search-param per CONTRIBUTING.md, which closed this PR's head ref).

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.

Add a useAllSearchParam hook

1 participant