Skip to content

A derived value with stores loses reactivity #15212

@hironytic

Description

@hironytic

Describe the bug

I found that a derived value loses reactivity after upgrading our project to use svelte 5.19.5.
See a minimal sample code in the playground below. Our actural codes are more complex.

Reproduction

https://svelte.dev/playground/990ac378ee8a40e9a168c1856c76de88?version=5.19.7 (Reproducible)

https://svelte.dev/playground/990ac378ee8a40e9a168c1856c76de88?version=5.19.5 (Reproducible)

https://svelte.dev/playground/990ac378ee8a40e9a168c1856c76de88?version=5.19.4 (Works as expected)

When the "Change Store" button is clicked, the value of the store is changed from "previous" to "new". But the text does not change.
If you comment out the line 8, it works fine. So toStore() is related to it, possibly.

Logs

System Info

System:
    OS: macOS 14.7.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 479.19 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.volta/tools/image/node/20.17.0/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 10.9.0 - ~/.volta/tools/image/npm/10.9.0/bin/npm
    pnpm: 9.10.0 - ~/.volta/bin/pnpm
    bun: 1.1.9 - ~/.bun/bin/bun
  Browsers:
    Chrome: 132.0.6834.160
    Safari: 18.1.1
  npmPackages:
    svelte: latest => 5.19.7

Severity

blocking an upgrade

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions