Description
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.
// current path: /students/classrooms/1
<router-link :to="{ name: 'students.classrooms' }">All Classrooms</router-link>
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
to students/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.