You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid field values in client-side enhanced form callback #16359
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.
(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