Skip to content

Commit

Permalink
Remove cast as URLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
IanPhilips committed Sep 19, 2024
1 parent 709b8c7 commit d4b230a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/hooks/use-defined-search-params.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useSearchParams } from 'next/navigation'
import { useCallback } from 'react'
import { URLSearchParams } from 'url'
export const useDefinedSearchParams = () => {
// Note: useSearchParams() must be used inside a <Suspense> component if page is SSR
const searchParams = useSearchParams()!
const createQueryString = useCallback(
(name: string, value: string) => {
const params = new URLSearchParams(searchParams as URLSearchParams)
// Note: don't cast searchParams as URLSearchParams or you'll break this instantiation
const params = new URLSearchParams(searchParams as any)
params.set(name, value)

return params.toString()
Expand Down

0 comments on commit d4b230a

Please sign in to comment.