Vue-router: 2.8 & 3.0 router-view props bug

Created on 12 Oct 2017  路  3Comments  路  Source: vuejs/vue-router

Version

2.8.0

Reproduction link

http://jsfiddle.net/9r6xhqbp/38/

Steps to reproduce

click /foo, msg is undefined

What is expected?

before 2.8.0, msg == 123

What is actually happening?

msg is undefined

regression

Most helpful comment

I'm also having this issue using route params. My route param will be initially passed, but then updated as an empty string.

const routes = {
  {
    name: "cluster-select",
    path: "/uploadconfigure/clusters/select/cluster/:slugName?",
    props: true,
    component: HdClusterViz,
    beforeEnter: (to, from, next) => {
      const selectedCluster = store.getters["clusters/clustersBySlugName"][to.params.slugName]
      if (selectedCluster) {
        store.dispatch("clusters/selectCluster", selectedCluster)
      } else {
        store.dispatch("clusters/deselectCluster")
      }
      next()
    }
  }
}

Reverting to 2.7.x fixed this for me.

All 3 comments

I'm also having this issue using route params. My route param will be initially passed, but then updated as an empty string.

const routes = {
  {
    name: "cluster-select",
    path: "/uploadconfigure/clusters/select/cluster/:slugName?",
    props: true,
    component: HdClusterViz,
    beforeEnter: (to, from, next) => {
      const selectedCluster = store.getters["clusters/clustersBySlugName"][to.params.slugName]
      if (selectedCluster) {
        store.dispatch("clusters/selectCluster", selectedCluster)
      } else {
        store.dispatch("clusters/deselectCluster")
      }
      next()
    }
  }
}

Reverting to 2.7.x fixed this for me.

I'm also experiencing this issue. Tested with both 2.8.0 and 3.0.0. I get a missing prop error for a router-view that accepts a prop. I also had to revert to 2.7.0 to get things back to normal.

If you are navigating programmatically, in $router.push() you could pass the props there. However, this is a painful solution, reverting to 2.7.0 is better.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shinygang picture shinygang  路  3Comments

gil0mendes picture gil0mendes  路  3Comments

marcvdm picture marcvdm  路  3Comments

sqal picture sqal  路  3Comments

saman picture saman  路  3Comments