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 6fc825b commit 01f91fd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const ViewReference: React.FC<ViewReferenceProps> = ({ node, paragraph }) => {
const pageParam = useMemo(() => `page-${hashId}`, [hashId])
// Get page from search params
const page = useMemo(
() => Number(searchParams.get(pageParam) || 1),
() => Number(searchParams?.get(pageParam) || 1),
[searchParams, pageParam],
)
// Construct view params
Expand Down

0 comments on commit 01f91fd

Please sign in to comment.