Skip to content

ui-router v1.0.0.beta.2 & Angular 1: ui-router hangs if you change state during resolve #3032

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

Closed
MystK opened this issue Sep 22, 2016 · 4 comments
Labels

Comments

@MystK
Copy link

MystK commented Sep 22, 2016

How to reproduce

  1. In your state, add a route that depends on an async(es6) resolve. Add a artificial timeout of 10 seconds.
  2. Navigate to that state
  3. Before the resolve completes, navigate somewhere else.
  4. After the artificial timeout, note that the URL changed but you are in state Pseudo Code #3.
  5. See that you are unable to change states until you hard refresh.

I will make a plunkr for this soon, unless someone else has time. :)

@christopherthielen
Copy link
Contributor

I think this is fixed in upcoming beta.3. #2972
Try adding this to your app as a workaround for beta.2:

$transitions.onFinish({}, function() {})

@MystK
Copy link
Author

MystK commented Sep 23, 2016

Thanks! That was it.

@josx
Copy link

josx commented Nov 22, 2016

Nice to read this!
Thanks a lot!

@RenanRossiDias
Copy link

For anyone who's still having problems with this:

I was using async calls within $transition hooks on my app.run.
Based on this answer, i created a TransitionService to manage application transactions and keep track of what transactions are running on application in order to guarantee that only one transaction happens at a time. I achieved this by saving the current transaction on TransitionService and then aborting any previously saved transaction on every new transaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants