-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Using named route persists old route params #906
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
Comments
Yeah, I'll take a look. |
👍 |
Thank you @fnlctrl @znck @yyx990803 |
@fnlctrl @znck @yyx990803 thanks for fixing this however it does not seem to address the issue. i have a similar setup, entering a sub-route with a optional parameter it does not drop the param when going back to parent route. url pattern: when entering works perfect on |
@sleewoo Are you using the latest version? If so, please provide a repro on jsfiddle, thanks! |
@sleewoo I updated to the latest version, it worked for me. |
@fnlctrl sure, updated 2.0.3 and almost deployed it to production but tests stopped me :) |
will try do a repro |
so here is a working version, using 2.0.1 and here is 2.0.3 clicking on |
query works well on both versions |
most likely is a shoot in the moon but could this be related? |
@sleewoo The latest release version worked for me. I don't have any optional parameters though. |
Seems to be a bug where optional params aren't |
@fnlctrl I'll fix this one. Route: |
The issue occurs again. Using path(absolute path) works fine but named route has the same issue as described by OP. [email protected]
From 'http://localhost:8080/#/distancedatatable/restaurant' and clicking on named route Expected: Current Behavior: |
Vue.js version
2.0.5
Vue-Router version
2.0.2
Reproduction Link
https://jsfiddle.net/erikgall/spz2j6o6/
Steps to reproduce / What is happening
The problem occurs when navigating back to a parent route (or sibling route) with no parameters from a child route that has a parameter. The bug seems to only happen when using named routes as well.
Component/Route Hierarchy
root component --> layout component (ex. student, instructor, guest) --> page component
-> ./app.vue
---> ./students.vue
------->./students/index.vue
-------> ./students/classrooms/index.vue (path:
students/classrooms
)-------> ./students/classrooms/show.vue (path:
students/classrooms/:classroom
)When navigating from the show.vue component to any other component the classroom param persists and is not removed.
students/classrooms/:classroom
tostudents/classrooms
This is an issue if you depend on using a v-if directive to render a component that should be inserted if a route param exists like in the example below.
What is Expected?
If a route contains a param it should be present in the
vm.$route.params
object and when navigating from that route to a new one the params object is updated to reflect the current url.The text was updated successfully, but these errors were encountered: