Skip to content

back() doesn't load route after hard reload on a shallow-pushed URL after pushState #16457

Description

@motherthestate

Describe the bug

I've encountered a weird behavior with shallow routing, don't know if this is a bug or limitation. Let me know :)

Reproduction

After opening a route as a shallow overlay with pushState, reloading on that URL, then
pushing a second, stacked pushState on top, the browser Back button updates page.url
but never swaps the mounted route. The wrong page component stays on screen.

Here a repo: https://github.com/motherthestate/svelte-shallow-repo

Logs

System Info

System:
    OS: macOS 26.5.1
    CPU: (8) arm64 Apple M1
    Memory: 92.88 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 26.2.0 - /Users/maxime.welter/.nvm/versions/node/v26.2.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 11.13.0 - /Users/maxime.welter/.nvm/versions/node/v26.2.0/bin/npm
    pnpm: 8.15.4 - /opt/homebrew/bin/pnpm
    bun: 1.3.14 - /opt/homebrew/bin/bun
    Deno: 1.40.4 - /Users/maxime.welter/.deno/bin/deno
  Browsers:
    Chrome: 150.0.7871.129
    Firefox: 152.0.6
    Safari: 26.5
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.1 => 7.0.1 
    @sveltejs/kit: ^2.63.0 => 2.70.1 
    @sveltejs/vite-plugin-svelte: ^7.1.2 => 7.2.0 
    svelte: ^5.56.1 => 5.56.7 
    vite: ^8.0.16 => 8.1.5

Severity

annoyance

Additional Information

No response

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