You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we have a nullable() or nullish() zod field it throws 'unknown type'.
We can't use our main zod types for uniforms directly because we use null fields in the mysql database and endpoints. We use both types: undefined to mean unchanged or unknown, and null to mean the field is empty.
Maybe treat nullable the same as optional in the forms? Set the field to null if not entered by user?
workaround
Create separate zod types for uniforms with optional() instead of nullish() or nullable(). Replace undefined fields with null in the onSubmit handler. Keep them updated with the main schema.
packages
import ZodBridge from "uniforms-bridge-zod";
import { AutoForm } from "uniforms-mui";
The text was updated successfully, but these errors were encountered:
problem
When we have a nullable() or nullish() zod field it throws 'unknown type'.
We can't use our main zod types for uniforms directly because we use null fields in the mysql database and endpoints. We use both types: undefined to mean unchanged or unknown, and null to mean the field is empty.
Maybe treat nullable the same as optional in the forms? Set the field to null if not entered by user?
workaround
Create separate zod types for uniforms with optional() instead of nullish() or nullable(). Replace undefined fields with null in the onSubmit handler. Keep them updated with the main schema.
packages
The text was updated successfully, but these errors were encountered: