Skip to content

Commit

Permalink
fix: Check for null next property on window (#456)
Browse files Browse the repository at this point in the history
Closes #454.
  • Loading branch information
franky47 authored Jan 15, 2024
1 parent 801ee87 commit ef75b2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nuqs/src/update-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function flushUpdateQueue(router: Router): [URLSearchParams, null | unknown] {
// miss pushed history updates.
// The router adapter imported from next/navigation also doesn't support
// passing an asPath, causing issues in dynamic routes in the pages router.
const nextRouter = window.next.router
const nextRouter = window.next?.router
const isPagesRouter = typeof nextRouter?.state?.asPath === 'string'
if (isPagesRouter) {
const url = renderURL(nextRouter.state.asPath.split('?')[0] ?? '', search)
Expand Down

0 comments on commit ef75b2c

Please sign in to comment.