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

PathNode.matching should not compare dynamic params #3033

Closed
christopherthielen opened this issue Sep 22, 2016 · 1 comment
Closed

PathNode.matching should not compare dynamic params #3033

christopherthielen opened this issue Sep 22, 2016 · 1 comment

Comments

@christopherthielen
Copy link
Contributor

  // Test for #2796
  it("should not re-resolve data, when redirecting to self with dynamic parameter update", (done) => {
    let $registry = router.stateRegistry;
    let $state = router.stateService;
    let $transitions = router.transitionService;
    let resolveCount = 0;

    $registry.register({
      name: 'dynamic',
      url: '/dynamic/{param}',
      params: {
        param: { dynamic: true }
      },
      resolve: {
        data: () => {
          new Promise(resolve => resolve('Expensive data ' + resolveCount++))
        }
      }
    });

    $transitions.onEnter({entering: "dynamic"}, trans => {
      if (trans.params().param === 'initial')
        return $state.target("dynamic", { param: 'redirected' });
    });

    $state.go("dynamic", { param: 'initial'}).then(() => {
      expect($state.current.name).toBe("dynamic");
      expect($state.params.param).toBe('redirected');
      expect(resolveCount).toBe(1);
      done();
    });
  });
});
@christopherthielen
Copy link
Contributor Author

#2796

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

1 participant