Skip to content

Commit

Permalink
fix: Mark global next internal as optional (#465)
Browse files Browse the repository at this point in the history
Closes #464.
  • Loading branch information
franky47 authored Jan 19, 2024
1 parent f9c89d3 commit f59c786
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/nuqs/src/update-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function scheduleFlushToURL(router: Router) {

declare global {
interface Window {
next: {
next?: {
version: string
router?: NextRouter & {
state: {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuqs/src/useQueryState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export function useQueryState<T = string>(
React.useEffect(() => {
// This will be removed in v2 which will drop support for
// partially-functional shallow routing (14.0.2 and 14.0.3)
if (window.next.version !== '14.0.3') {
if (window.next?.version !== '14.0.3') {
return
}
const value = initialSearchParams.get(key) ?? null
Expand Down

0 comments on commit f59c786

Please sign in to comment.