Skip to content

Commit

Permalink
Check if searchParams is defined before getting params
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed May 17, 2024
1 parent 01f91fd commit ca00b3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/drupal/src/lib/useSearchApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const useSearchApp = (
const searchParams = useSearchParams()
const router = useRouter()
const qsParam = `qs-${searchIndex}`
const qs = searchParams.get(qsParam) || ''
const qs = searchParams?.get(qsParam) || ''
const djap = new DrupalJsonApiParams(qs)

const currentQueryObject = djap.getQueryObject()
Expand Down
2 changes: 1 addition & 1 deletion packages/next-drupal/src/hooks/useSearchApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useSearchApp = (
const searchParams = useSearchParams()
const router = useRouter()
const qsParam = `qs-${searchIndex}`
const qs = searchParams.get(qsParam) || ''
const qs = searchParams?.get(qsParam) || ''
const djap = new DrupalJsonApiParams(qs)

const currentQueryObject = djap.getQueryObject()
Expand Down

0 comments on commit ca00b3d

Please sign in to comment.