Closed max-got closed 2 weeks ago
This is intentional I believe, just how JS works, you should use $state(structuredClone($unstate(initialObject)))
In your Svelte 4 REPL, you mutate $initalObj
's value without triggering the store, so it isn't re-rendered. More correct Svelte 4 example.
In Svelte 5 $state objects are just proxied (correct me if I'm wrong) to the original. Example.
Describe the bug
Details
I hope this isn't intended. Modifying the newObj $state object unexpectedly affects the initialObj $state object as well, see the following: ```svelteinitialObj.count : {initialObj.count}
newObj.count : {newObj.count}
```nevermind...
need to adapt to svelte 5... see Svelte 4 REPL
Reproduction
Repl
Logs
No response
System Info
Severity
blocking an upgrade