Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router push loses locale with basePath #905

Closed
Oberwaditzer opened this issue Mar 2, 2024 · 2 comments · Fixed by #906
Closed

Router push loses locale with basePath #905

Oberwaditzer opened this issue Mar 2, 2024 · 2 comments · Fixed by #906
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@Oberwaditzer
Copy link
Contributor

Oberwaditzer commented Mar 2, 2024

Description

If a basePath is configured in the nextConfig it gets lost with router.push. With a Link it works fine.

Mandatory reproduction URL

https://codesandbox.io/p/devbox/great-jerry-s6ylgc

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. You should be now on /base-path/de
  3. Click on Link
  4. you are now on /base-path/de/test-page
  5. go back
  6. Click on Router Push
  7. you are now on /base-path/test-page

Expected behaviour

If using router.push in combination with basePath the locale should also be carried with.

@gentrith44belt
Copy link

gentrith44belt commented Mar 5, 2024

+1

export const { Link, redirect, usePathname, useRouter } = createSharedPathnamesNavigation({
	locales,
	localePrefix,
});

export default function Page() {
	redirect("./profile");
}

it's not working with basePath config.

image

@amorinabelt
Copy link

+1

redirect('/profile') it's not working with basePath config.

image

+1

amannn added a commit that referenced this issue Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants