hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
115 stars 30 forks source link

Query parameter is added to the URL within the address bar. #43

Closed gehaktmolen closed 2 years ago

gehaktmolen commented 2 years ago

Everything has been working fine so far. Love your work. However I noticed a problem where the query parameter for dynamic pages is added to the URL within the address bar. I setup a simple example here to reproduce the problem: codesandbox example

Even when I check some of my older branches of 4 weeks ago, where I used version 1.7.2, I get the same issue. So it is probably not related to next-translate-routes, but maybe something else changed. A dependency of a dependency or something. Using different versions of nextjs doesnt help either.

Anyway, not using pathname and query to define the url within the "href" property still works, but I am pretty sure the aforementioned behaviour is not intended.

So in short:

<Link href={{ pathname: "/blog/[slug]", query: { slug: "derp" } }}>
          Link to dynamic page
        </Link>

Results in this URL: /blog/derp?slug=derp

Instead of: /blog/derp

cvolant commented 2 years ago

@gehaktmolen, thanks for reporting. I experienced the same problem. A complicated one: it took me a few days to rewrite a sensitive part. You can try the lastest prerelease: 1.9.0-2. I think it is nearly ready to be published as 1.9.0, but if you can try it and confirm that it works well, it would help.

cvolant commented 2 years ago

@gehaktmolen, v1.9.0 is out, and I don't experience this issue any more. It you do, please reopen it.