Link-component drops query string when localePrefix is set to as-needed · Issue #1731 · amannn/next-intl · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query string is not present in the generated href from next-intl's Link component.
When localePrefix is set to as-needed, the query string is not present for default locale, but is present for other locales (which has the locale prefix).
Example:
Setup
Default locale set to en and sv available as another locale
As a side note, while looking into the issue you discovered, I think I found a chance for a great improvement for the localePrefix: 'as-needed' & domains case: #1733. This combination was always bugging me and required special care, but I think I finally have an idea for a clean solution for this use case.
Since you're using this combination, would you like to have a look and provide feedback? next-intl@4 is currently in beta and it would offer a chance to get the required breaking change in.
Description
Query string is not present in the generated href from
next-intl
's Link component.When
localePrefix
is set to as-needed, the query string is not present for default locale, but is present for other locales (which has the locale prefix).Example:
en
andsv
available as another localelocalePrefix
set toas-needed
The minimal reproduction covers the bug, but I thought that I could highlight how our setup looks like since it differs a little bit:
sv
as default locale, domain.no hasno
as default locale)en
as default locale, but alsoes
and other localeslocalePrefix
is set toas-needed
as we want domain.se to point tosv
Verifications
Mandatory reproduction URL
https://github.com/seanpavlov/reproduction-next-intl-missing-query-string
Reproduction description
Getting started
How to reproduce the bug
Expected behaviour
Expected behavior
Expected behavior is that both the default locale and the other locales generates a href with the query string included:
Possible solution
By passing
query: href.query
here I managed to get the expected behavior.Could that be a solution or would it have other implications?
The text was updated successfully, but these errors were encountered: