Using drizzle-zod on zod-based form

Hey guys, just wondering if you have a clean solution to implement useAppForm schema and reuse drizzle-zod exposed schema.

I'm constantly facing null vs. undefined and troubled to find a clean way to reuse select schema.

  const form = useAppForm({
    defaultValues: {
      // environmentId: activeEnvironment?.id ?? "",
      name: "",
      lastName: "",
      email: "",
      mobile: "",
      country: "TH",
      clientReferenceId: "",
    } as CustomerCreateForm,
    validators: {
      onSubmit: CustomerInsertSchema,
    },
    onSubmit: async ({ value }) => {
      await createCustomer(value)
      modal.handleClose()
    },
  })


My schema: https://pastebin.com/raw/7cHUjDXN
Was this page helpful?