kit icon indicating copy to clipboard operation
kit copied to clipboard

`fields.value()` data missing, despite setting values

Open sillvva opened this issue 3 weeks ago • 0 comments

Describe the bug

The issue happens when you assign form.fields to a variable and then attempt to access .value(). This:

const fields = test.fields;
const initial = await input();
fields.set(initial);

Results in:

// initial
Initial: {
  "id": "019ab1c1-1b5e-770a-b6fc-de57e8fe44f3"
}
// fields.value()
Values: {}

Reproduction

https://stackblitz.com/edit/sveltekit-308957-8ktcalyf?file=src%2Froutes%2F%2Bpage.svelte

Logs


System Info

System:
    OS: macOS 26.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 279.19 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.0 - /Users/sillvva/.nvm/versions/node/v24.11.0/bin/node
    npm: 11.6.2 - /Users/sillvva/.nvm/versions/node/v24.11.0/bin/npm
    pnpm: 10.21.0 - /Users/sillvva/.nvm/versions/node/v24.11.0/bin/pnpm
    bun: 1.2.20 - /Users/sillvva/.bun/bin/bun
  Browsers:
    Firefox: 144.0
    Safari: 26.1
  npmPackages:
    @sveltejs/adapter-node: ^5.4.0 => 5.4.0 
    @sveltejs/kit: ^2.49.0 => 2.49.0 
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
    svelte: 5.41.4 => 5.41.4 
    vite: ^7.2.4 => 7.2.4

Severity

serious, but I can work around it

Additional Information

The cause is that data?.input is empty undefined when accessed in the field proxy methods. Thus returning {} on .value().

data?.input undefined
(get_cache(__)[''] ?? {}).input {
  id: '019a3697-fab9-7645-87ba-1902ec42a9df',
  name: 'Brooke Emberbreath',
  race: 'Human',
  class: 'Fighter / Arcane Trickster',
  campaign: 'Forgotten Realms',
  characterSheetUrl: 'https://www.dndbeyond.com/characters/154842629',
  imageUrl: 'https://i.imgur.com/ApkyJMQ.jpeg',
  firstLog: false
}

https://github.com/sillvva/kit/blob/ab3784911accefd8d3bc292a80d8e3b825528fd3/packages/kit/src/runtime/app/server/remote/form.js#L198-L220

sillvva avatar Nov 23 '25 17:11 sillvva