Open bgentry opened 6 years ago
@bgentry code you show a snippet of your workaround? I think I'm facing this same issue
I believe this was:
// broken route.js
...
myTask: task(function*() {
this.transitionTo("otherRoute");
}),
// working route.js
...
myTask: task(function*() {
Ember.run(() => this.transitionTo("otherRoute"));
}),
In my own code I had myTask
calling another function that contained the transitionTo
, but I don't think that's relevant to the issue.
Same issue when doing:
myTask: task(function*() {
this.router.transitionTo("otherRoute");
}),
I just ran into a scenario where a route task was calling a function inside my route that itself called
.transitionTo()
on the route. I was randomly seeing failures with the transition. After doing some debugging on route transitions, it turned out that I was seeing my app transition to the new route and then immediately transition back to the previous one. I didn't have any hooks on the routes in question that might be aborting the transition or anything like that.Eventually I figured out that if I enqueue that function call w/ the
transitionTo
inside a runloop, everything works 100% of the time.Is this expected?