Skip to content

Async Svelte: Navigation with preload and conditional bind:this causes page to flash then revert #14923

@jose-manuel-silva

Description

@jose-manuel-silva

Describe the bug

I'm experiencing what appears to be a related issue to sveltejs/svelte#17118, but with different symptoms specific to SvelteKit navigation.

Setup:

  • Route structure: /[test] with +page.svelte and +layout.svelte
  • Layout contains a shadcn sidebar using conditional bind:this
  • Main page has links to /a and /b

Bug behavior:

  1. Hovering /a and clicking → works correctly
  2. Hovering /a, then hovering /b, then clicking /b → page navigates to /b, then immediately navigates back to the previous page (less than a second), BUT the URL remains /b

Environment:

  • Async: enabled (If disabled, it works correctly)

Workaround:
Disabling data-sveltekit-preload-data fixes the issue.

Question:
Will the fixes in sveltejs/svelte#17147 and #14865 address this navigation issue, or is this a separate problem?

Reproduction

If needed, heres minimum repro: https://github.com/jose-manuel-silva/svelte-repro.git
(probably could be smaller, sorry for that)

The conditional bind:this is in $lib/components/ui/sidebar/sidebar-menu-button.svelte

Logs

System Info

System:
    OS: macOS 15.5
    CPU: (10) arm64 Apple M4
    Memory: 68.34 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.9.0 - /opt/homebrew/bin/node
    npm: 11.6.0 - /opt/homebrew/bin/npm
    pnpm: 10.20.0 - /opt/homebrew/bin/pnpm
    bun: 1.3.1 - /opt/homebrew/bin/bun
  Browsers:
    Safari: 18.5
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.0 => 7.0.0 
    @sveltejs/kit: ^2.48.4 => 2.48.4 
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
    svelte: ^5.43.6 => 5.43.6 
    vite: ^7.1.10 => 7.2.2

Severity

serious, but I can work around it

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