-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
Describe the bug
When you have two awaits in a $derived you will get a unssafe_state_mutation error even though no state is being updated:
let postsAndComments = $derived({
posts: await posts(),
comments: await comments()
})Reproduction
https://www.sveltelab.dev/ds3d9yw8emutk33
Logs
Uncaught (in promise) Svelte error: state_unsafe_mutation
Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
https://svelte.dev/e/state_unsafe_mutationSystem Info
System:
OS: macOS 26.1
CPU: (16) arm64 Apple M4 Max
Memory: 42.27 GB / 128.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - /Users/kevin/.volta/tools/image/node/22.12.0/bin/node
npm: 10.9.0 - /Users/kevin/.volta/tools/image/node/22.12.0/bin/npm
pnpm: 10.4.1 - /Users/kevin/.volta/bin/pnpm
bun: 1.3.4 - /Users/kevin/.bun/bin/bun
Deno: 2.5.6 - /opt/homebrew/bin/deno
Browsers:
Chrome: 143.0.7499.41
Safari: 26.1
Safari Technology Preview: 26.0
npmPackages:
svelte: ^5.46.0 => 5.46.0Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels