Skip to content

Inconsistent page.params reactivity in top level async derived #14996

@jkbz64

Description

@jkbz64

Describe the bug

When page.params param is used in a top level await derived it sometimes gets updated (without a reactivity change) after the top-level await executes but the value should always be known and updated before running the top level await/component.

Reproduction

Svelte: 5.45.2

SvelteLab

Click on any route link in main route, it should always return 1 length but it very often returns 0 then go back and re-entry it, click it enough times and it returns 0.

As a workaround you can store the value in some global state before navigating with goto instead of using <a> link.

bug.webm

Logs

System Info

System:
    OS: Linux 6.14 Fedora Linux Asahi Remix 42 (Forty Two [Adams])
    CPU: (8) arm64 unknown
    Memory: 7.42 GB / 31.11 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.19.0 - /home/jk/.n/bin/node
    Yarn: 1.22.22 - /home/jk/.n/bin/yarn
    npm: 10.9.3 - /home/jk/.n/bin/npm
    bun: 1.3.3 - /home/jk/.bun/bin/bun
  Browsers:
    Chromium: 142.0.7444.175
    Firefox: 145.0.1
    Firefox Developer Edition: 145.0.1

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions