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

core: routing - navigateToPrevious() stays on the current state if last state was navigated twice (dynamic params) #773

Closed
christophercr opened this issue Oct 17, 2018 · 0 comments · Fixed by #785

Comments

@christophercr
Copy link
Collaborator

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

After navigating two or more times to the same current state in order to change the state parameters (dynamic transition), every single transition is kept in the Routing Service state history as a different transition. Then, calling the navigatToPrevious() once will not navigate to the previous page but to the previous transition of the current state, meaning that the navigateToPrevious() should be called as many times as dynamic transitions were made.

Expected behavior

Calling navigateToPrevious() once should navigate to the previous page regardless of whether the previous transition(s) where dynamic or not.

Minimal reproduction of the problem with instructions

  1. Define two states A & B, state B has a dynamic parameter
  2. Navigate to state A
    -- _starkStateHistory = [A]
  3. Navigate to state B
    -- _starkStateHistory = [A, B]
  4. Update B's dynamic parameter (by using navigateTo())
    -- _starkStateHistory = [A, B, B]
  5. Call navigateToPrevious()
    -- service tries to navigate to B instead of A, a second call to navigateToPrevious() will go back to state A

What is the motivation / use case for changing the behavior?

Consistent "navigate to previous" functionality.

Environment


Angular version: 6.1.8
Stark version: 10.0.0-beta.0

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