You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Frozen objects can not be written into a $state().
If for example some external library creates objects that are frozen, these objects can not be written into a svelte $state since [email protected] because the proxy tries to extend the value object or array with additional properties.
This prevents to use such external libraries in combination with svelte, especially if the objects in questions are not easily cloneable/unfreezable - for example nested objects and arrays containing DOM nodes.
My concrete use-case is the partial.lenses library. Its an optics library that can be used to read and updated nested objects. It freezes all new objects by default. These objects can then not be stored inside a $state. It did however work until [email protected]
Uncaught TypeError: can't define property Symbol("$state"): Array is not extensible in App.svelte proxy proxy.js:63 set proxy.js:297 App App.svelte:422
Describe the bug
Frozen objects can not be written into a $state().
If for example some external library creates objects that are frozen, these objects can not be written into a svelte $state since [email protected] because the proxy tries to extend the value object or array with additional properties.
This prevents to use such external libraries in combination with svelte, especially if the objects in questions are not easily cloneable/unfreezable - for example nested objects and arrays containing DOM nodes.
My concrete use-case is the partial.lenses library. Its an optics library that can be used to read and updated nested objects. It freezes all new objects by default. These objects can then not be stored inside a $state. It did however work until [email protected]
Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACo1Ty2rDMBD8FSEKcSA4d5MESiFQKBR6rXtQ7HWqIq-EtE7bGP97JfnRmEDIwQ-tZkaz43XLK6nA8ey95Shq4Bl_NIavOP2asHAnUAR-7XRji1DZuMJKQ7sccyo0OmJKHvYW4Azu9fAFBTm2ZWQbCIhwVQ0WJDUyp2t48eBh_WRBkMTj3mp9BuzJyUmoBpasjWySVXIlP23mZIEai6zfSKsIS1qJCDZjUalb9tiOgXJwxZxjB2h4hNsN72-R7s0_B37ybYUxUE7OBvWhnMZDRtV5JoJ0nUiU5EPDRqlJQgF5y7764EiQ7ypazO4LMQgux9ZnlqYAjl4_SiYXeU6w2-2CSvvPNPK61fjmJtnTTHek-IbuG4Mr7W4WoOrP8XIxwcUnKKUXnrRZ_w8obiSahlgY5m3OCX4o5-wgscyimW0ItffVsXXPcEbg7qLu9ULF_wK1LmUloeRZmO7uo_sDJ_qskT0DAAA=
Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: