dotJEM / angular-routing

Enhanced state based routing for Angular applications!
https://dotjem.github.io/angular-routing/
MIT License
75 stars 9 forks source link

calling goto while goto is in progress. #59

Closed jeme closed 10 years ago

jeme commented 11 years ago

Having a transition that is slow due to resolving values can cause the next transition to fail, we start by getting a:

Error: Can't start multiple transactions
    at Object.$get.$view.beginUpdate (https://rawgithub.com/dotJEM/angular-routing/master/build/angular-routing.js:2758:27)
    at https://rawgithub.com/dotJEM/angular-routing/master/build/angular-routing.js:1749:45
    at deferred.promise.then.wrappedCallback (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:7303:59)
    at deferred.promise.then.wrappedCallback (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:7303:59)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:7340:26
    at Object.$get.Scope.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:8685:28)
    at Object.$get.Scope.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:8548:23)
    at Object.$get.Scope.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:8771:24)
    at HTMLHtmlElement.<anonymous> (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:5972:20)
    at HTMLHtmlElement.x.event.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js:5:10006) 

and then:

TypeError: Cannot call method 'cancel' of undefined
    at https://rawgithub.com/dotJEM/angular-routing/master/build/angular-routing.js:1810:37
    at deferred.promise.then.wrappedErrback (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:7312:57)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:7388:53
    at Object.$get.Scope.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:8685:28)
    at Object.$get.Scope.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:8548:23)
    at Object.$get.Scope.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:8771:24)
    at HTMLHtmlElement.<anonymous> (http://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.js:5972:20)
    at HTMLHtmlElement.x.event.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js:5:10006)
    at HTMLHtmlElement.x.event.add.y.handle (http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js:5:6789) 

Try doing rapid clicking on the front page links here: http://plnkr.co/edit/CPEKaqfdZREIvu7A3hQr?p=preview

jeme commented 10 years ago

Refactored view transactions so they work issolated. https://github.com/dotJEM/angular-routing/commit/9cc1eb0437cc4835de393e9f9934f8d4c51e389d https://github.com/dotJEM/angular-routing/commit/01196b5222a0a279a7b256b39a18bffbe4bd0cbf https://github.com/dotJEM/angular-routing/commit/3240e078cf382558a9730ea5f2c3cd80e1103b50

Still needs to cancel out promises as well

jeme commented 10 years ago

new sample: http://plnkr.co/edit/zsEYpxpFYUAc1NVo3PGH?p=info

Still happens on the about page under a specific situation where a goto is started, but canceled out by one to the current state then another event.

(Click link 1, wait, then click 3, 1, 2)

thorn0 commented 10 years ago

Still happens for me.

A plunk that illustrates the issue: http://plnkr.co/edit/CfhCoH?p=info Click on 'About' and then quickly click on 'Contact'.

thorn0 commented 10 years ago

It's more difficult to reproduce it now, but it still happens sometimes if you click several links really fast.

jeme commented 10 years ago

I have tried to click as crazy fast I can, without any luck in reproducing it... So is this happening in the sample you provided or in a project your working on, if the later there may be some other factors affecting this as well?...

thorn0 commented 10 years ago

It's in my project. I'll try to isolate it.

thorn0 commented 10 years ago

Looks like it's been fixed by d35eab28d9. It's reproduced only without that commit.

jeme commented 10 years ago

ok... I have a few other minor things I wan't to look into before making a 0.6.8 release, but it that change will be in there (it was mostly a theoretical fix, but it adds some preparation for pushing more and more focus towards the pipeline implementation)