-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX beta] Check state of router during transition #14223
[BUGFIX beta] Check state of router during transition #14223
Conversation
Currently, during transitions, the state of the router is not taken into consideration. This change makes sure that both `transitionTo()` and `replaceWith()` examine the state of the router and uses that information to choose the appropriate method. If there has never been a transition since the app loaded, `replaceWith()` will be used. If there's been a transition already `transitionTo()` will be used instead. Regardless of which method the developer used.
if (router.router.oldState) { | ||
return router.transitionTo(...prefixRouteNameArg(this, arguments)); | ||
} | ||
return router.replaceWith(...prefixRouteNameArg(this, arguments)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the logic be swapped around here so that the "default" thing we do is transitionTo
from Route#transitionTo
.
Thanks for working on this! A few things that we need to do:
|
There are a couple of issues with this:
|
as an architectural issue, I wonder if these fixes shouldn't actually be in router.js rather than just for ember - AFAIK the bug is actually at the lower level in the router library |
PR filed to router tildeio/router.js#197 |
Will be fixed by tildeio/router.js#197, closing this one... |
Currently, during transitions, the state of the router is not taken into
consideration. This change makes sure that both
transitionTo()
andreplaceWith()
examine the state of the router and uses that informationto choose the appropriate method.
If there has never been a transition since the app loaded,
replaceWith()
will be used. If there's been a transition already
transitionTo()
willbe used instead. Regardless of which method the developer used.
Special thanks to @alexspeller. In so many ways this work belongs to him.