Skip to content
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

vue-router 3.0.5 router onComplete no longer executed #2721

Closed
twickstrom opened this issue Apr 17, 2019 · 5 comments
Closed

vue-router 3.0.5 router onComplete no longer executed #2721

twickstrom opened this issue Apr 17, 2019 · 5 comments

Comments

@twickstrom
Copy link

twickstrom commented Apr 17, 2019

Version

3.0.5

Reproduction link

https://codesandbox.io/embed/74y8ok1kpj

Steps to reproduce

In a vuex action I have a simple block of code:

In my action.js file for my auth module I have the following block of code:

import Vue from 'vue'

login ({ commit }, data) {
  Vue.router.push({
    name: 'dashboard'
  }, () => {
    store.dispatch('app/loaded')
  })
}

What is expected?

The onComplete callback of the router.push call should be executed.

What is actually happening?

The onComplete callback of the router.push call should be executed.


I rolled back to 3.0.4 and this issue went away. This is code that I have not touched in 6 months and has had many vue-router upgrades without issue.

The reproduction link is a very simplified version simply click on "Click me for callback failure" you should get an alert showing the click event was executed. The route will change too: /#/foo but the callback of alert('callback') is never executed.

@LinusBorg LinusBorg added the bug label Apr 17, 2019
@posva posva added regression and removed bug labels Apr 17, 2019
@posva
Copy link
Member

posva commented Apr 17, 2019

thanks, it's probably related to the fix introduced in #2712

@posva posva removed the regression label Apr 17, 2019
@posva
Copy link
Member

posva commented Apr 17, 2019

the callback wasn't passed correctly as the second argument:

this.$router.push({ name: 'foo' }, function () {
        // This will never execute
        alert('callback');
      })

it was passed like this:

this.$router.push({ name: 'foo', function () {
        // This will never execute
        alert('callback');
      }})

@posva posva closed this as completed Apr 17, 2019
@twickstrom
Copy link
Author

@posva,

Sorry about the type in my example. It's weird that did sem to resolve the simplified version. In my code base however this problem persists but only in 3.0.5. I will dig deeper to see why.

@lukeajtodd
Copy link

lukeajtodd commented May 28, 2019

I'm also having a similar issue, tried it with 3.0.3 and 3.0.6. May be something specific to the codebase I'm working on but I'll try and get an example of it happening up later.

To sum it up though. The callback doesn't seem to fire for any reason and as far as I can see my routes will always eventually resolve so I don't think it's an issue with the guards.

@AlexanderBredun
Copy link

@posva it still doesnt work, event if you change here https://codesandbox.io/embed/74y8ok1kpj to this
this.$router.push({ name: 'foo' }, function () { // This will never execute alert('callback'); })
it doesnt work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants