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

Router adds duplicate entry to session history stack #1792

Closed
3 tasks done
zqianem opened this issue Jan 13, 2023 · 0 comments · Fixed by #1827
Closed
3 tasks done

Router adds duplicate entry to session history stack #1792

zqianem opened this issue Jan 13, 2023 · 0 comments · Fixed by #1827

Comments

@zqianem
Copy link
Contributor

zqianem commented Jan 13, 2023

Describe the bug

When navigating to a VitePress site from any other domain (e.g. this link: https://vitepress.vuejs.org/), the VitePress router adds a duplicate entry to the browser session's history stack. This occurs because history.pushState() is called via router.go() on the initial page load.

The effect of this depends on the browser.

  • In Chromium-based browsers, due to implementing History Manipulation Intervention, the back button works as expected and the user returns to the previous page (e.g. this page).

  • Safari implements something similar and the back button also works as expected.

  • In Firefox, the user has to click the back button twice to return.

In all cases, the duplicate entry is still visible in the history stack.

Reproduction

  1. Visit https://vitepress.vuejs.org/ by left clicking the link.
  2. Right click (if Safari, long press) on the browser's back button and notice there is an extra entry.

Expected behavior

The extra entry is not added, like when visiting https://developer.mozilla.org/en-US/.

System Info

System:
    OS: Linux 6.1 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 23.05 GB / 30.74 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.19.0 - /usr/bin/node
    npm: 8.19.2 - /usr/bin/npm
  Browsers:
    Chromium: 109.0.5414.74
    Firefox: 108.0.2

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@zqianem zqianem added the bug: pending triage Maybe a bug, waiting for confirmation label Jan 13, 2023
@brc-dd brc-dd removed the bug: pending triage Maybe a bug, waiting for confirmation label Jan 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants