Skip to content

Commit bd8cdba

Browse files
committed
fix: nextjs router regression
1 parent 7526500 commit bd8cdba

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/core/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"url-state",
1717
"search",
1818
"params",
19-
"query"
19+
"query",
20+
"front-end"
2021
],
2122
"description": "React hook for managing state in the URL",
2223
"dependencies": {},

packages/core/src/router.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ export class GenericRouter implements UrlStateRouter {
3333
push(href: string): void {
3434
// Use Next.js router if available
3535
// Next.js exposes a global object `window.next.router` with a `push` method for both /pages and /app routes
36-
if (typeof window.next?.router?.push === 'function') {
37-
window.next.router.push(href);
38-
} else {
39-
window.history.pushState({}, '', href);
40-
}
36+
// if (typeof window.next?.router?.push === 'function') {
37+
// console.log('Next.js router is available');
38+
// window.next.router.push(href);
39+
// } else {
40+
// console.log('Next.js router is NOT available');
41+
window.history.pushState({}, '', href);
42+
// }
4143
this.onSearchParamsChange();
4244
}
4345

0 commit comments

Comments
 (0)