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

transition canceling issues #22

Closed
ryanflorence opened this issue Jun 10, 2014 · 4 comments
Closed

transition canceling issues #22

ryanflorence opened this issue Jun 10, 2014 · 4 comments

Comments

@ryanflorence
Copy link
Member

when you cancel a transition on willTransitionFrom

  • the url changes to the next route, needs to be changed back
  • any views don't update anymore when clicking links

Check out the transitions example to see this behavior.

@mjackson
Copy link
Member

I believe the best and simplest solution to this issue would be to use window.history.back() in the piece of code that handles cancelled transitions. This would effectively change the URL back to whatever it was before the transition started, and it would preserve the ability to manually enter a new URL into the location bar (as opposed to requiring all URL changes to go through transitionTo, for example).

In this solution, the router that aborted the transition should remain unaffected by the URL change because it would never actually update its components properties. The problem with this approach would be with other routers on the same page that are also observing the URL. They would effectively see two changes to the URL in quick succession, which would probably cause some weirdness.

The best way to solve this would be to use a dispatcher singleton that is responsible for listening to the URL and dispatching transition objects to routers that need to know about URL changes. When the URL changes, it would dispatch a new Transition and wait for all transition hooks to resolve before actually telling routers to proceed with the transition and update their components.

@mjackson
Copy link
Member

The "transitions" example code runs fine with this commit.

@mjackson
Copy link
Member

It's actually one better than Ember's router because the URL is always kept in sync with what is on the page, even when it is manually changed but the transition is aborted.

@ryanflorence
Copy link
Member Author

:fistpump:

On Wed, Jun 11, 2014 at 9:34 AM, Michael Jackson notifications@github.com
wrote:

It's actually one better than Ember's router because the URL is always
kept in sync with what is on the page, even when it is manually changed but
the transition is aborted.


Reply to this email directly or view it on GitHub
#22 (comment)
.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants