Skip to content

History state is overwritten to {} during navigation since next.208 #3236

@gustavopch

Description

@gustavopch

Describe the bug

Since @sveltejs/[email protected], goto()'s state parameter stopped working. This line is overwriting the state to {} whenever navigation occurs:

history.replaceState({}, '', info.url);

This is the commit that introduced the bug: d17f459.

Reproduction

  • Open the repro: https://stackblitz.com/edit/sveltekit-xfxpb3
  • Click the button "Goto with state".
  • It will take you to another route where the History state will be visible.
  • You'll see the state will be empty. It should be what was passed to goto().

Logs

No response

System Info

System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
    Memory: 112.81 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.asdf/installs/nodejs/16.13.1/bin/node
    Yarn: 1.22.17 - ~/.asdf/installs/nodejs/16.13.1/.npm/bin/yarn
    npm: 8.2.0 - ~/.asdf/installs/nodejs/16.13.1/.npm/bin/npm
    Watchman: 2021.11.15.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 97.0.4692.71
    Safari: 15.1
  npmPackages:
    @sveltejs/adapter-auto: 1.0.0-next.9 => 1.0.0-next.9 
    @sveltejs/kit: 1.0.0-next.208 => 1.0.0-next.208 
    svelte: 3.44.3 => 3.44.3

Severity

blocking all usage of SvelteKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp3-edge-caseSvelteKit cannot be used in an uncommon wayrouter

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions