Skip to content
Source
Sign inSign up
TanStack/form

fix: type serverValidate decoded values #2332

Openkkkhs(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/2332/headopened

Showing 5 changed files with 29 additions and 5 deletions (loading 2).

x
0 of 5 viewed, 5 left
6 additions and 0 deletions.changeset/quiet-lamps-warn.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/react-form-nextjs': patch
+'@tanstack/react-form-remix': patch
+---
+​
+Fix `createServerValidate` return types to reflect decoded `FormData` values instead of inferred form values.
4 additions and 5 deletionspackages/react-form-nextjs/src/createServerValidate.tsModified
View file
@@ -99,12 +99,11 @@
})
​
- const values = (info
- ? decode(formData, info)
- : decode(formData)) as never as TFormData
+ const values = info ? decode(formData, info) : decode(formData)
+ const validationValues = values as never as TFormData
​
const onServerError = (await runValidator({
- value: values,
+ value: validationValues,
validationSource: 'form',
})) as UnwrapFormAsyncValidateOrFn<TOnServer> | undefined
​
@@ -120,7 +119,7 @@
errorMap: {
onServer: onServerError,