saj
TTCTheo's Typesafe Cult
•Created by saj on 2/19/2024 in #questions
Generate a dynamic zod schema for a user created form
If a user is creating a form we output this:
how do i generate a schema to use in the react-hook-form zod resolver to validate the fields? notice how we have sections->fields, and each field has a "required" which indicates true/false, and then "response" is where we capture the response. we generate a different field object to represent required/optional based on the "type" of the field, e.g. "textfield" is a basic zod object string
i've tried several things
2 replies
TTCTheo's Typesafe Cult
•Created by saj on 8/7/2023 in #questions
How do you revalidateTag or revalidatePath with a server component prisma fetch or server action?
I am not using next.js fetch out of the box, just a prisma get. How do I revalidate it with a tag or even the whole path when I submit a form? Next.js examples are all based on the fetch() and/or api route.
4 replies
TTCTheo's Typesafe Cult
•Created by saj on 4/26/2023 in #questions
Question about Prisma Joins and Performance
I'm starting to stack multiple "joins" with prisma but am getting concerned with the approach. I read that joins in general may not be great for performance so that this could be a plus, but maybe I misread or am making that up. What is the consensus on Prisma's way of handling joins or the idea that raw query is not type safe?
Is anyone regularly stacking joins with Prisma and have any pro tips? Example:
11 replies