Describe the bug
If you use await in <script> before a binded $state variable, an error is thrown:
Cannot read properties of undefined (reading 'f')
For example, this works:
<script>
import Input from './Input.svelte';
let value = $state(0);
let data = await fetch('...');
</script>
<Input bind:value />
but this throws an error:
<script>
import Input from './Input.svelte';
let data = await fetch('...');
let value = $state(0);
</script>
<Input bind:value />
Reproduction
REPL
Logs
Error: Cannot read properties of undefined (reading 'f')
in <unknown>
in __wrapper.svelte
at get (playground:output:3903:22)
at get value (playground:output:4737:13)
at eval (playground:output:4622:87)
at capture_store_binding (playground:output:4572:12)
at prop (playground:output:4622:36)
at Input (playground:output:4711:3)
at App.add_svelte_meta.componentTag (playground:output:4735:10)
at add_svelte_meta (playground:output:568:11)
at App (playground:output:4734:3)
at add_svelte_meta.componentTag (playground:output:4770:27)
System Info
Severity
blocking an upgrade
Describe the bug
If you use
awaitin<script>before a binded$statevariable, an error is thrown:For example, this works:
but this throws an error:
Reproduction
REPL
Logs
System Info
Severity
blocking an upgrade