Skip to content

Invalid field values in client-side enhanced form callback #16359

Open

Description

@echocrow

Describe the bug

Field values read in a remoteForm.enhance() callback may be (a) misaligned with the defined type (e.g. returning undefined instead of the typed non-nullable string[]), and (b) out of date when fields were controlled programmatically.

Consequently:

  • Calling myForm.fields.myIds.map(...) may break at runtime. TS may have typed myIds as string[], but at runtime the value may resolve to undefined, and calling .map() will throw an uncaught `Uncaught TypeError.
  • Client-side enhanced form logic that relies on field values via myForm.fields may not read the correct values.

Reproduction

Repro along with demo instructions:

https://stackblitz.com/edit/sveltekit-enhanced-form-missing-client-values?file=md!README.md

See

  • Instructions: README.md
  • Code: src/routes/+page.svelte & src/routes/form.remote.ts

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.3 - /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
npmPackages:
  @sveltejs/kit: ^2.69.3 => 2.69.3 
  @sveltejs/vite-plugin-svelte: ^6.2.4 => 6.2.4 
  svelte: ^5.56.5 => 5.56.5 
  vite: ^7.3.6 => 7.3.6

Severity

serious, but I can work around it

(current hacky workaround may be to call myForm.fields.myField.set(...) inside of an $effect for a managed field)

Additional Information

Notably:

  • new FormData(myForm.element) inside .enhance() shows all the expected values client-side
  • in the server-side remote form function, the values are all as expected

Also, I could have sworn that this used to work fine in a previous sveltekit version, and thought perhaps v2.68.0 introduced a regression. But even after reverting way back to February (v2.52.2) this bug is present.

Activity

  1. added
    bugSomething isn't working
    formsStuff relating to forms and form actions
    and removed
    bugSomething isn't working
    on Aug 4, 2026
  2. added theissue type on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    formsStuff relating to forms and form actions

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions