Skip to content

Derived not updating #15435

@finnolavm

Description

@finnolavm

Describe the bug

After updating svelte version from 5.20.3 to >= 5.20.4 I got problems with reactivity.
In the provided example you can click play, and the isPlaying goes from false to true, but not back to false again like It should.

This was not a problem prior to 5.20.4.

The problem arises only when I get the store from a stores object like this:

import stores from "./stores";
const audioStore = stores.audioStore;

Works in every version if I do:
import { AudioStore } from "./audio-store.svelte";
const audioStore = new AudioStore();

Also works if I do this in AudioStore:
audioStatus = $state("stop")
audioUrl = $state(null)

instead of this:
store = $state({
status: "stop",
url: null
});
audioStatus = $derived(this.store.status);
audioUrl = $derived(this.store.url);

Reproduction

Does not work in 5.20.4 https://svelte.dev/playground/a22b8d2d05054459b5d29f73bd1cf524?version=5.20.4
Does work in 5.20.3 https://svelte.dev/playground/a22b8d2d05054459b5d29f73bd1cf524?version=5.20.3

Logs

System Info

System: OS: macOS 15.3.1 CPU: (14) arm64 Apple M4 Pro Memory: 289.19 MB / 24.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm Browsers: Chrome: 133.0.6943.142 Edge: 133.0.3065.92 Safari: 18.3 npmPackages: svelte: ^5.20.3 => 5.20.3

Severity

blocking an upgrade

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