-
-
Notifications
You must be signed in to change notification settings - Fork 15
Description
If we are trying to implement the schema as the single source of truth, and we are building the form in the Valibot schema, why are we breaking the contract by initializing the form with undefined as default values?
If my schema states name: v.optional(v.string()) — then yes, initialInput for name should be undefined.
But if my schema states name: v.string() — then the initialInput should be "".
Currently, this forces the developer to manually create an initialInput object, which is just copying their schema into a JavaScript object.
I think inferring the initialInput object from the schema will improve DX and push towards a true single source of truth.
I can work on a PR but I just want to know if there is a compelling reason why Formisch chose to go that way?