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

Double transition with async route resolver #52

Closed
lexigren opened this issue Feb 15, 2017 · 2 comments
Closed

Double transition with async route resolver #52

lexigren opened this issue Feb 15, 2017 · 2 comments
Labels
Milestone

Comments

@lexigren
Copy link

lexigren commented Feb 15, 2017

version: 1.0.0-beta.4
For some reason in newly created angular-cli project, if resolver returns promise that resolves asynchronously, second transition to same state appearing without waiting for promise result.

export function twoRouteResolver() {
  return new Promise(resolve => {
    setTimeout(() => {
      console.log('%cchecking', 'color:red;');
      console.log('resolving');
      resolve();
    }, 1000);
  });
}

Without timeout second transition does not appear.

Demo:
https://github.com/lexigren/UIRouterResolverProblemDemo

@christopherthielen
Copy link
Member

Thanks for the demo. I'll look into this before releasing the next beta.

@christopherthielen christopherthielen added this to the 1.0.0-beta.5 milestone Feb 17, 2017
@christopherthielen
Copy link
Member

This is due to angular/angular#7908

The HashLocationStrategy invokes the registered onPopState callback for both the popState and hashChange events. This causes two transitions to be initiated.

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

2 participants