-
Notifications
You must be signed in to change notification settings - Fork 603
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
Application route mixin can register duplicate event handlers #256
Comments
I've uploaded an example application demonstrating the issue, but found the same behaviour on ember-cli-simple-auth-example when opening the application directly at |
closed by #257 |
@marcoow I'm seeing this same "duplicated call" behavior with 0.7.2 and Ember 1.10. Is it possible this fix regressed somehow, or is there something I'm missing? Here's what I'm seeing with some debugging log statements added:
|
@tehviking: can you update to 0.7.3 first to make sure the problem still exists there? |
On checking again, I thought I was on 0.7.2 but I was on 0.7.3 the whole time. |
When my application loads directly on an authenticated route and the user isn't logged in, the initial transition is aborted as expected and it redirects to the login route. The Application route mixin's
beforeModel
hook is called before the transition is aborted, and again during the transition to the login route, because the application route hasn't been set up yet (this behaviour is described here). This seems to result in listeners for events such assessionAuthenticationSucceeded
being registered twice on the simple-auth session object.Both transition 0 and transition 1 call the application route's beforeModel hook:
It seems that when a user logs in, the application route mixin's
sessionAuthenticationSucceeded
action is fired twice. Which means it tries to handle the original aborted transition twice:In my case it never redirects to the original (authentication required) route, because the second time
sessionAuthenticationSucceeded
is triggered,attemptedTransition
is already null, which triggers a transition to therouteAfterAuthentication
route.For now I'm locked to an older release of Ember (and using the now-deprecated Ember App Kit), so I'm not sure whether this is still an issue, or whether I'm doing something facepalm-worthy? As far as I can tell aborted transitions still seem to behave this way in more current Ember releases, since it was described as "the way transitions work" in another thread which was resolved well before the release I'm using. Have I stumbled onto a valid issue or should I fix this in my own application route?
The text was updated successfully, but these errors were encountered: