Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
canDeactivate() is triggered twice #45
referenced this issue
May 21, 2015
I also have the canDeactivate function exectued twice but i don't have a canActivate in the next route. When this problem happens, the deactivate function doesn't get triggered aldough the page is navigated away from.
note: ok seems the detached() was called instead. Which is a bit strange, because it's not an attribute or custom element. It's a base class which is overriden. In some/most situations it calls deactivate. In some it calls detached. I don't know why but cleanup works now.
What is the desired behavior here? If
I believe that I just ran into this as well. canDeactivate is triggered, then there is a redirect, and then canDeactivate is triggered again. Like @flieks, there is no canActivate for me either, so it has nothing to do with that. This has been a bug for over 2 years. I think the suggestion by @davismj is the way to go: prevent multiple calls to the same canDeactivate() per activation cycle.