-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
When using $derived to get the value from a store containing an object, updates to the stored value don't cause the derived value to update. I suspect this is not by design, because $effect does handle those updates appropriately. If this is a known limitation, perhaps it should be mentioned in the docs.
Can work around by copying the object with Object.assign.
// This doesn't work:
let x = $derived($myObjectStore);
// This works:
let x = $derived(Object.assign({}, $myObjectStore));Reproduction
Logs
No response
System Info
System:
OS: macOS 15.0
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Memory: 36.44 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.9.0 - /usr/local/bin/npm
pnpm: 8.0.0 - /usr/local/bin/pnpm
Browsers:
Chrome: 131.0.6778.204
Safari: 18.0
npmPackages:
svelte: 5.14.4 => 5.14.4Severity
annoyance
webJose
Metadata
Metadata
Assignees
Labels
No labels