Skip to content

[Svelte 5] Bindings to nested fields are not immediately reactive when the target is a class field. #9661

@AgarwalPragy

Description

@AgarwalPragy

Describe the bug

Bindings for nested fields are reactive when the target is a standalone value, but not immediately reactive when the target is a class field.

Reproduction

REPL

<script>
  let val = $state({x: {y: ''}});
	
  class Value {
    x = $state({y: ''})
  }

  const obj = new Value()
</script>

<div>     reactive: <input bind:value={val.x.y} /> {val.x.y}</div>
<div>semi-reactive: <input bind:value={obj.x.y} /> {obj.x.y}</div>

Note that the 2nd binding is semi-reactive - if you change the value in 2nd input, nothing happens, until you also change the value in the 1st input.

Logs

No response

System Info

N/A

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