Skip to content

Using {location: 'replace'} to go back to the previous state should pop history instead of creating two identical entries #1590

@imgx64

Description

@imgx64

Here's an example plunker (launch the preview in a separate window to see the history).

  1. The app starts at state0. History is /state0.
  2. Press the button to go to state1. History is /state0, /state0/state1.
  3. Press the button to go to state2. History is /state0, /state0/state1, /state0/state1/state2.
  4. Press the Go back button (which uses {location: 'replace'}) to go back to state1. History is now /state0, /state0/state1, /state0/state1, with duplicate /state0/state1.

I think a better behavior is to remove the duplicate state from history when this happens. The current behavior breaks the browser back button (now you have to click back twice to go back to state0).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions