Skip to content

Commit

Permalink
fix: Forward optional remaining args from Next.js router to wrapped `…
Browse files Browse the repository at this point in the history
…useRouter`
  • Loading branch information
amannn committed Jul 5, 2023
1 parent 063de41 commit 3ff878c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/next-intl/src/client/useRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export default function useRouter() {

return {
...router,
push(href: string) {
return router.push(localize(href));
push(...[href, ...args]: Parameters<typeof router.push>) {
return router.push(localize(href), ...args);
},
replace(href: string) {
return router.replace(localize(href));
replace(...[href, ...args]: Parameters<typeof router.replace>) {
return router.replace(localize(href), ...args);
},
prefetch(href: string) {
return router.prefetch(localize(href));
prefetch(...[href, ...args]: Parameters<typeof router.prefetch>) {
return router.prefetch(localize(href), ...args);
}
};
}, [locale, router]);
Expand Down

3 comments on commit 3ff878c

@vercel
Copy link

@vercel vercel bot commented on 3ff878c Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

example-next-13-next-auth – ./examples/example-next-13-next-auth

example-next-13-next-auth.vercel.app
example-next-13-next-auth-next-intl.vercel.app
example-next-13-next-auth-git-main-next-intl.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 3ff878c Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-example-next-13 – ./examples/example-next-13

next-intl-example-next-13.vercel.app
next-intl-example-next-13-next-intl.vercel.app
next-intl-example-next-13-git-main-next-intl.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 3ff878c Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-intl-docs – ./docs

next-intl-docs-next-intl.vercel.app
next-intl-docs-git-main-next-intl.vercel.app
next-intl-docs.vercel.app

Please sign in to comment.