Skip to content
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

Route transition always updates URL lazily #10917

Closed
anobin opened this issue Apr 21, 2015 · 2 comments
Closed

Route transition always updates URL lazily #10917

anobin opened this issue Apr 21, 2015 · 2 comments

Comments

@anobin
Copy link

anobin commented Apr 21, 2015

I've noticed that when transitioning to a new route the URL will lazily update (ie. not until the route is completely done transitioning). This can create issues with slow or failed transitions as refreshing the page will put you back into the old route.

I did some digging and found that ember has switched between eager and lazy over time.

I also noticed that the docs are currently out-of-date:
"URLs always update immediately unless the transition was aborted or redirected within the same run loop."
http://guides.emberjs.com/v1.11.0/routing/loading-and-error-substates/

I do like the idea of the route rendering being eager or lazy based on whether a loading route is provided or not; is there anyway this can be extended to URL updating? Basically, it would be nice if there were some way to configure whether a transition will update the URL eagerly or lazily.

I am currently forcing eager updates by replicating a bit of code from when transitions did update the url eagerly:

var transition = this.transitionToRoute('newRoute', {queryParams: queryParams});

var newUrl = transition.router.generate('newRoute', {queryParams: transition.queryParams});
if (transition.urlMethod === 'update') {
    transition.router.updateURL(newUrl);
} else if (transition.urlMethod === 'replace') {
    transition.router.replaceURL(newUrl);
}
transition.method(null); // Prevent later update url refire.
@seawatts
Copy link

I'm also running into this issue

@rwjblue
Copy link
Member

rwjblue commented Aug 16, 2015

Closing in favor of emberjs/guides#596.

@rwjblue rwjblue closed this as completed Aug 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants