Skip to content

Commit

Permalink
fix: fixed nextjs 13.x (pages) routing problems which would load a pr…
Browse files Browse the repository at this point in the history
…evious page when route queries are involved
  • Loading branch information
BowlingX committed Jul 19, 2023
1 parent 6a1f529 commit cf2676e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ export {
createOrApplyPath,
defaultSkipValue,
} from './lib/utils.js'
export { default as default } from './lib/adapters/historyjs/index.js'
16 changes: 8 additions & 8 deletions src/lib/adapters/nextjs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ interface Props {
// tslint:disable-next-line:no-mixed-interface
readonly routerPush?: (
url: Url,
as: UrlObject,
as?: UrlObject,
options?: TransitionOptions
) => Promise<boolean>
// tslint:disable-next-line:no-mixed-interface
readonly routerReplace?: (
url: Url,
as: UrlObject,
as?: UrlObject,
options?: TransitionOptions
) => Promise<boolean>
}
Expand Down Expand Up @@ -83,14 +83,14 @@ export const GeschichteForNextjs: FC<Props> = ({

if (routerPush) {
return routerPush(
{ pathname, query: Router.query },
{ pathname, query },
{ query: Router.query },
{ query, pathname },
routerOptions
)
}
return Router.push(
{ pathname, query: Router.query },
{ pathname, query },
{ query: Router.query },
{ query, pathname },
routerOptions
)
},
Expand All @@ -104,13 +104,13 @@ export const GeschichteForNextjs: FC<Props> = ({

if (routerReplace) {
return routerReplace(
{ pathname, query: Router.query },
{ query: Router.query },
{ pathname, query },
routerOptions
)
}
return Router.replace(
{ pathname, query: Router.query },
{ query: Router.query },
{ pathname, query },
routerOptions
)
Expand Down

0 comments on commit cf2676e

Please sign in to comment.