-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
When using form remote function with a dynamic/stateful (e.g. $derived from a query function) preflight validation and, at the same time, using enhance to prevent form field resets:
- Submitting the form for the first time triggers the remote function one time
- The second time, two more calls are made
- Upon the third time, 4 more calls are made, then 8, etc.
The linked REPL also includes a reset button for the queried value the dynamic schema depends on.
If you press the command 5 times (fresh state), the form function gets called 5 + 1 times when you finally invoke it. A second invocation then would increase the call count from 6 to 12 etc.
Basically, everytime the server sends back the query result that the schema depends on (after both reset & increment), we increase the misbehavior.
The app behaves as expected when:
- removing the enhance (which will make the fields reset again)
- plugging in a "static" validation schema into
preflightinstead
I am not sure if this is a duplicate of #14546 where the same issue is triggered from a slightly different setup.
Reproduction
Try out this REPL to immediately see the observed issue: https://www.sveltelab.dev/nyh216e52lcv453
Just click the "Increment" button a few times
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: 20.19.1 - /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/adapter-auto: ^3.0.0 => 3.3.1
@sveltejs/kit: ^2.5.27 => 2.49.4
@sveltejs/vite-plugin-svelte: ^5.0.0 => 5.1.1
svelte: ^5 => 5.46.3
vite: ^6.0.0 => 6.4.1Severity
blocking an upgrade
Additional Information
No response