Skip to content

Unexpected behaviour with $state.frozen() and $bindable() #12803

Closed
@mjadobson

Description

@mjadobson

Describe the bug

When binding a variable declared with $state.frozen to a child component, reassigning the prop in the child component throws an error. The child component wraps it in a Proxy object, which is incompatible with $state.frozen.

Error: state_frozen_invalid_argument The argument to `$state.frozen(...)` cannot be an object
created with `$state(...)`. You should create a copy of it first, for example with `$state.snapshot`

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE41SPW_cMAz9K4TQwUYNO8no8xloMnUrMnSpO8gW3QgnS4JEX5oK-u-B7PtqcmgzCNITyEfyPQY2SoWe1T8C03xCVrMv1rKC0YtNwO9REbKCeTO7If00fnDSUtvpjuRkjSN4eJJKwOjMBB0rqwWWa2bHNikwHYUEghOHLXzyxAnL0Zk_qLMAg5k11XADMU_huqNx1gNJo0HqweGEmrIcwkJFB5IAZVmmd3HMT6Bc3vAZbiEupeNfdLMVnDAzb8nMMbapzvPppp-JjAajByWH3Tacuont1-OzqdaottPNk4Mq3bY991JDOIPYVDYFrJL1Uot66WDtaxvWO0LVsoJNRshRomA1uRljcbJoyf6oSUn3cFI-leS9wiwvDkUhpn_rjPXZO_kdeqTvkt9LLT7gwM2F6NdovjljzzQHM67S5NcNEXIPnl4UbjtmuRBS_6rhFqcN9MYJdDXc2d_gjZICejXjpmOLCO-cvBwsto8JwV5ySBiy3pkd6vzC2n9QpKEuKRKG7Nm4nX_DcFiPjv6_IJWQ-ys78DO-Amk4BwSyAwAA

Logs

No response

System Info

Svelte 5.0.0-next.216

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions