-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Milestone
Description
Describe the bug
Svelte chokes when altering the content of a nested store using the $ syntax.
(i.e)
<script>
import { writable } from "svelte/store";
let store = writable({
inner: writable("string"),
});
$: ({ inner } = $store);
$: inner.set("new string"); // this works
//$: $inner = "other new string"; // this doesn't
$: $inner && ($inner = "other other new string"); // this works!?
</script>
<h1>Hello {$inner}!</h1>Logs
Results in a Cannot read property 'set' of undefined error.
To Reproduce
REPL repro
Expected behavior
I should be able to assign a value to a nested Svelte store using the $ systax.
Severity
Low severity. It's only a convenience, and probably a rarely used pattern to nest stores.
Additional context
I'm not familiar with Svelte internals but I suppose this may be vaguely related to #4079 and #3637 ??