-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
Describe the bug
Array inside state fails:
let s = $state({ a: [1, 2, 3] });
...
s = {}'
Error:
Uncaught TypeError: Cannot read properties of undefined (reading '0')
at get a (playground:output:3973:23)
at eval (playground:output:3931:26)
at eval (playground:output:3303:55)
at update_reaction (playground:output:2104:57)
at update_effect (playground:output:2243:19)
at set (playground:output:422:8)
at HTMLButtonElement.on_click (playground:output:3945:27)
at HTMLBodyElement.handle_event_propagation (playground:output:2817:11)
While a plain $state([]) seems to work - I'm getting update with undefined as expected:
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA5WQwWrDMBBEf2VRApFB2LS9ObKh9BNytHxQFDkRlSVhbVqK0L8X2ZAWeupxh53ZnZfIZKyOpB0ScXLWpCWvIRBG8CuUIX5oi5owEv19UUXhUS0mIFjprp0gGAXphRNo5uAXhDc_B--0Q5gWP8Ohbh5KvYUdjsIVg9UIETrYR5So6fDE4JnBy1gdhePNdqUkO36-I3oH3ilr1HuXaAVdD7SYh7HK_UkjnEoIb7bV1ZZ2ZoKYy6m001LdIIKMIBmYVRTIf549G3dpZZfiYMYMzdooNcWVhUuNmbJwhJHZX8xk9IW0uNx1Zg9oj6T_owMAKCwSyEKjfCLPVtMKcpnD4kOk1QqtrO6Ni0ErpLKqPw3eKEUGaiWivIve6tr66yZurl8weeiTzLwJ_d8yY_4G81ONhA0CAAA=
Reproduction
Run in playground
Logs
No response
System Info
5.0.0-next.264Severity
annoyance