-
Notifications
You must be signed in to change notification settings - Fork 3k
Resolves aren't aborted if state is changed while resolving #2126
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
Comments
I don't think that's something we can make work automatically. You'd have to wire it into your |
Yeah 1 should be handled in the implementation. 2 however should have one of the two fire but I guess it doesn't matter with 1.0 |
Is this planned to be resolved? |
@jullian-chavez I see what you did there. 😉 It's not really on the immediate horizon, as it's going to some figuring out, and we already have a bunch of work on our plates, but we're taking suggestions and ideas in the meantime. |
Haha, didnt even notice that. Any suggestions on how to minimize this issue in the mean time? Otherwise, I think our dev team is going to take a whack at making a fix for this. We'll share if/how we are able to come to a solution for this. |
Well, you can wrap your Part of the problem is that there's no generalized way to cancel a promise, and most people wrap up their remote calls (resolves) in services.
That'd be great. Looking forward to seeing what you come up with. |
I just came across the same problem. I think I can provide two solutions for the 2nd problem, each with different drawbacks. First SolutionWe should broadcast a if ($state.transition !== transition) return TransitionSuperseded; with: if ($state.transition !== transition) {
$rootScope.$broadcast('$stateChangeCancel', to.self, toParams, from.self, fromParams);
return TransitionSuperseded;
} The only problem is that the event is triggered AFTER the resolves and not at the moment the transition is cancelled (e.g. when we set Second SolutionWe should broadcast a This approach needs more changes (since we need to create "global" variables to hold the to/from variables of the cancelled transition to properly broadcast the event) and is not tested (only theory-crafting). Currently, I'm going with the first approach since it's a quick non-breaking workaround, but I personally prefer the second approach since it will be a solid base to allow us to solve the 1st problem as well (we can wrap every resolve with a promise that has an abort function and abort them when we cancel the transition). |
@nateabele @eddiemonge Any thoughts? |
I don't think this is something we're going to address until 1.0, since all the |
This issue has been automatically marked as stale because it has not had This does not mean that the issue is invalid. Valid issues Thank you for your contributions. |
http://plnkr.co/edit/NdkPaZQ1Yvczf8mYcMZI?p=preview
If a state (B) is transitioned to and then another state (C) is transitioned to while B's resolves are still pending, those resolves are still completed.
This present two problems:
The text was updated successfully, but these errors were encountered: