Skip to content

5.0.0-next.227: Reading $state in script tags does not return the current value if the variable is not referenced outside of script tags #13022

Closed
@lts20050703

Description

@lts20050703

Describe the bug

5.0.0-next.227: Reading $state in script tags does not return the current value if the variable is not referenced outside of script tags

Downgrading to 5.0.0-next.226 and it works again.

Reproduction

Reproduction: https://www.sveltelab.dev/q619bx8mtraspmd

The number printed to the console is always 0

... unless the variable is referenced outside of script tag (https://www.sveltelab.dev/7r3mc9ydsw6heco)

Downgrading to 5.0.0-next.225 and it works again, no need to reference the variable outside of script tag (https://www.sveltelab.dev/8nijtfv76v7wjz8)

Logs

No response

System Info

System:
    OS: Linux 6.8 KDE neon 6.1 6.0
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 8.22 GB / 15.41 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.6.0 - ~/.local/share/pnpm/node
    Yarn: 1.22.22 - ~/.local/share/pnpm/yarn
    npm: 10.8.2 - ~/.local/share/pnpm/npm
    pnpm: 9.7.1 - ~/.local/share/pnpm/pnpm
    bun: 1.1.16 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 128.1.69.153
  npmPackages:
    svelte: ^5.0.0-next.238 => 5.0.0-next.238

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions