Skip to content

Spreading form.fields.foo.as("select") onto a Select component does not work #15750

@Stadly

Description

@Stadly

Describe the bug

This does not work. Changing the value in the Select component does not update createForm.fields.foo.value().

  <Select.Root {...createForm.fields.foo.as("select")} type="single">
    <Select.Trigger>
      {createForm.fields.foo.value()}
    </Select.Trigger>
    <Select.Content>
      <Select.Item value="1">1</Select.Item>
      <Select.Item value="2">2</Select.Item>
      <Select.Item value="3">3</Select.Item>
    </Select.Content>
  </Select.Root>

Maybe it's because bind is not being used on value, but why then does <select {...createForm.fields.foo.as("select")}> work without bind? If bind is required for function bindings to work on components (but not elements?), maybe Svelte should emit a warning or error when providing a getter and setter without using bind?

Reproduction

https://stackblitz.com/edit/github-fpvwzt8d?file=src%2Froutes%2F%2Bpage.svelte

Logs

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 22.22.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm

Severity

annoyance

Additional Information

No response

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