Call next's callback in beforeRouteUpdate - #2054
Conversation
|
As for failing tests, I'm having the same issue as #2043: all tests pass locally, and I don't have permissions to re-run the build. |
|
I launched a rebuild |
posva
left a comment
There was a problem hiding this comment.
Hey, completely forgot about asking it, but could you add one or multiple tests for this, please?
|
No problem: added tests and updated en docs. |
|
Hey @posva, when you have a chance, could you take a look at this again? Thanks! |
posva
left a comment
There was a problem hiding this comment.
Sorry, forgot to specify, but I was thinking about a unit test. Could you replace the test you added to a unit one? You should find an example at api.spec.js. You can add it there, I will reorganise later
|
I've been looking into making these unit tests, and it's not looking promising. The problem is that Vue doesn't seem to be creating any children components when not in-browser, so none of the hooks on any children routes are being extracted since there's no instance for const app = new Vue({
render(h) { return h('router-view') },
router: new Router({
routes: [
{ path: '/', component: Root
children: [
{ path: 'foo', component: Foo },
{ path: 'bar', component: Bar },
]}
]
})
}).$mount()It looks like Using what's currently in app.spec.js obviously has the same problem: no component instances are actually created, so Any thoughts on this? |
|
@posva Any thoughts here? |
|
What's the progress on this pull request? Are we waiting for further changes? |
|
@jpicton I'm waiting on feedback for next steps. It's possible to rewrite parts of my tests as unit tests, but as I explained in my previous comment, it doesn't seem possible to test all functionality via unit tests. |
From the discussion in #1582. This PR addresses a few important points:
nextinbeforeRouteEnterandbeforeRouteUpdatebehaves the same.When
router-viewhas a key, you can now access the newvmfromnext, making it possible to update the new component. Example:All callbacks added by
next(cb)are called after navigation has finished, ensuring that torn updates don't happen. Example: