Skip to content

Svelte 5: $derived in class not working for updated $state #10313

@kuechlerm

Description

@kuechlerm

Describe the bug

I try to render the values of a $derived array or even the $derived of that. When the underlying value gets updated, this does not reflect in the $derived. I have two cases modeled in the REPL. Only one case can be "fixed" by using the values in an $effect.
To reproduce, please uncomment the console.logs in the $effect and change the CASE on the bottom.
I guess, it is related to the $derived property of the Store (s) class "d1", because CASE 3 and 4 work as expected.

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE4WTUYubQBSF_8rtsLAKxmw0fTGJsJRSSmkLm0If1lBs5ro76WRGZq7ZFPG_l4naaLshgg_e-c517pwzNSuERMuSx5qpfI8sYfdlyQJGv0v3YQ8oCVnArK7M1lWWdmtESWmmMhL7UhuCWqvPulLUFEbvIetEGVsMGdtAtxxO12GLhDvbUiojiQQ8ghXccDTigNyzIZ-FhZCExjvCKoUjpBD5_lAQjwW5lJcULT8f8jy-CLv3BosCt-R5vlutT2WaTgGN0QYKbeDd_fo9zBbw_evDp49fPpxrUQ9vtbJaYij1k1fzWQJuqAB41PRjXGipNMGLNr-Eerra9kozyBW_sqO2ATXn4TtLPc9fpd3oNqxKnhP-OOSyQm8gWU7PoVBLLg7p-llXksNPhDiYB2-T5dRVT8tvJpMOareXQH1yeqeF8m6DW7_p4ckkHZJRAjWPXuEc-e8zFMZOGL8iPCPzS0imWMD2motCIGcJmQqb4O9d6YN8vjA7O7wsW5lbC2vSBtsA5VK6BFrKCb3HWRAF8aY9SD4bRpOexSjNuYtgPsr_2IzeI6RvYo-6GjmXUd8PVtD-1bmyad2mJoDo7q7zM1NNpvB4urQuKwQWVqDwpR3D8xf_H8im-QOexa2FSAQAAA==

Logs

No response

System Info

REPL

Severity

blocking an upgrade

Metadata

Metadata

Assignees

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