-
Notifications
You must be signed in to change notification settings - Fork 27k
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 loses query params after push() with a dynamic route #26508
Comments
This is the API for
Sounds more like we fixed a bug where query was incorrectly appended to the shown path in the newer versions 🤔 cc @ijjk |
We've also encountered a serious regression after upgrading Next.js from v10.2.0 to any higher, including 11.0.x. I was able to track the problem down, it was introduced in #25112. I've created a better reproduction case: https://github.com/vlad-zhukov/nextjs-router-query-missing The index page works as expected, clicking the button shallowly changes query params. Now got to and page reloads, |
Closing as a duplicate of #26169 |
Hi, this has been updated in |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.0.1
What version of Node.js are you using?
14.17.0
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Local build
Describe the Bug
I think I have found a router regression. When calling
router.push
with a dynamic route, any query string values are lost on the new route if the asPath value doesn't have those query string values. This was working in10.1.3
and i think it broke around10.2.x
. Something like:where there is a
[catchall]/new.js
page. See the reproduction repo below.Expected Behavior
Query parameters should be accessible with dynamic routes when asPath doesn't contain the query params
To Reproduce
Clone and run https://github.com/alecrae/nextjs-router-query-missing
Go to the index page and then on load it will execute a
router.push
to a new page, the query params is missing. Downgrade the next version to10.1.3
and it will workThe text was updated successfully, but these errors were encountered: