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

Link href doesn't update when search params change when localePrefix is set to never. #918

Closed
jorgemoya opened this issue Mar 6, 2024 · 5 comments · Fixed by #926
Closed
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@jorgemoya
Copy link

jorgemoya commented Mar 6, 2024

Description

If a Link is present in a client component and the url depends on the existing searchParams, the url is not updated when the searchParams change. For some reason this happens when createSharedPathnamesNavigation is invoked with localePrefix: "never", default value seems to work fine.

Mandatory reproduction URL

https://codesandbox.io/p/github/jorgemoya/next-intl-bug-repro-app-router/main?import=true

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. Click on Foo link
  3. Hover over Broken Link and notice it doesn't include foo=bar search params when it should.

Alternate:

  1. Open reproduction
  2. Click on Foo link
  3. Refresh page
  4. Click on Home link
  5. Hover over Broken Link and notice it does include foo=bar search params when it shouldn't.

Expected behaviour

The expected behavior would be for the Broken Link link the match the search params present, even after they update.

@amannn
Copy link
Owner

amannn commented Mar 7, 2024

I can unfortunately not follow your reproduction steps in the provided reproduction, seems like the template is unchanged. Any chance you didn't commit the latest changes?

@jorgemoya
Copy link
Author

I can unfortunately not follow your reproduction steps in the provided reproduction, seems like the template is unchanged. Any chance you didn't commit the latest changes?

Yes, you're correct, should work now. Sorry about that. 🙏

@amannn
Copy link
Owner

amannn commented Mar 7, 2024

Thanks! I can reproduce the issue and a fix is coming!

amannn added a commit that referenced this issue Mar 8, 2024
@amannn
Copy link
Owner

amannn commented Mar 8, 2024

This is fixed in next-intl@3.9.4!

Thank you so much for taking the time to build a great reproduction, that helped a lot with finding the cause and fixing it!

@jorgemoya
Copy link
Author

Thanks for the quick fix!

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.

2 participants