Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props must be serializable for client components #3

Closed
thepeterkovacs opened this issue Jul 22, 2023 · 2 comments
Closed

Props must be serializable for client components #3

thepeterkovacs opened this issue Jul 22, 2023 · 2 comments

Comments

@thepeterkovacs
Copy link

This issue occurs in the date-picker ui component at the setDate prop when using it in Next.js 13.4.

"use client"
...
export function DatePicker({ date, setDate }: { date?: Date; setDate: (date?: Date) => void }) {
...

setDate can not be of type (date?: Date) => void

@vantezzen
Copy link
Owner

From what I can tell, it looks like serialization for the whole zod schema is problematic with server components. I tried using the SuperJSON plugin but that only throws other serialization errors.

For now, I would recommend using the AutoForm component inside a client component. If someone finds a way to enable using AutoForm in server components I'm happy to accept a PR!

@vantezzen vantezzen pinned this issue Aug 1, 2023
@raphaelmsr
Copy link

Hey there! Would this help in anyway ? https://kitchen-sink.trpc.io/react-hook-form?file=feature%2Freact-hook-form%2Findex.tsx#content
Just found that looking for options in zod's repo issues! Would gladly help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants