Skip to content

Clicking a router link results in a replaceState *and* a pushState #960

@glen-84

Description

@glen-84

Version

4.0.8

Reproduction link

https://jsfiddle.net/gob8sL0q/

Steps to reproduce

  1. Open the JSFiddle.
  2. Click the links.
  3. Check the console.

What is expected?

Only pushState should be called (as far as I know).

What is actually happening?

replaceState is called with the current URL, followed by pushState with the new URL.


I ran into this while trying to integrate Google Tag Manager and Google Analytics. GTM has a History Change trigger, and it is triggering twice for each navigation because of this issue.

While I could probably filter out the replaceState calls, this should not be necessary if I'm understanding correctly, and just makes GTM more difficult to work with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions