Skip to content
Discussion options

You must be logged in to vote

Omitting/passing undefined to keyMap denote it should subscribe to all search params.

How would that work with type safety?

The strength of nuqs hooks is that they are declaratively scoped to specific search params keys, stitch updates automatically, and scale by composing them together.

Resetting all search params is a navigation: you could do so with a router call, routing to whatever usePathname is currently set to (and wrapping that in a transition):

function useResetSearchParams() {
  const pathname = usePathname()
  const router = useRouter()
  const [isPending, startTransition] = useTransition()
  const reset = useCallback(() => {
    startTransition(() => {
      // or replace, …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by franky47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
duplicate This issue or pull request already exists
2 participants