Skip to content

Svelte 5: state_unsafe_mutation on trying to mix stores with runes #13840

@ceifa

Description

@ceifa

Describe the bug

It throws an error when set the value of a rune inside the start notifier of a writable store:

state_unsafe_mutation Updating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without $state in {expression} in App.svelte

Reproduction

https://svelte.dev/playground/hello-world?version=5.0.5#H4sIAAAAAAAACm2OwWrDMAyGX0UThSQQFno1jmG3vcO8g9Mq1ODYxlbaDeN3H-7W7bLj_-nXJxVcraOM4q0gf0ZCcQc4ojdbSy8xPucrOW5sMZn-46fgmTxnFCjzKdnISnvNdoshMRS4JctmcQQV1hQ26L43p8whUad9KztiuGeY4ZDZMPWrcZmGx7AdhvnX1Xe3kNy5G6EfYFZQWk_zQ8Fpp0bqoL2c_p7y8nJUr-RcgHJoyvokp8tRaS-tjzvDYv1ZXI3baf4pKByR6YNRNGl9r18XIK7LNQEAAA==

Logs

No response

System Info

Not relevant

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