form icon indicating copy to clipboard operation
form copied to clipboard

onServerValidate doesn't work with Zod in NextJs

Open heinsenberg82 opened this issue 5 months ago • 1 comments

Describe the bug

onServerValidate doesn't seem to work properly with Zod schemas. Instead of populating the form with error messages, the form is receiving entire objects. Here's a link that reproduces the issue: https://stackblitz.com/edit/tanstack-form-3wvkfapn?file=src%2Fapp%2Faction.ts

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-3wvkfapn?file=src%2Fapp%2Faction.ts

Steps to reproduce

Go to link to reproduce the issue. Try to enter a number like '9'.

Expected behavior

Form should be populated with error messages, not zod error objects.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

Windows 11

TanStack Form adapter

None

TanStack Form version

1.14.1

TypeScript version

No response

Additional context

No response

heinsenberg82 avatar Jul 08 '25 21:07 heinsenberg82

Based on this (https://github.com/TanStack/form/releases/tag/v0.43.0), I made another fork following (I think) the instructions there, but still not working: https://stackblitz.com/edit/tanstack-form-q5ym4nkq?file=src%2Fapp%2Fclient-component.tsx

heinsenberg82 avatar Jul 09 '25 14:07 heinsenberg82