What is the new or updated feature that you are suggesting?
For the nested object syntax it would be handy to seed only a subset of the fields. For example, consider a todo app where we want to pre-fill the first todo based off a previous interaction
Functionally, it looks like ValidatedForm already works like this. Just the Typescript type need to be updated. As a work around in my codebase, I've been re-exporting the ValidatedForm component with a DeepPartial type for the defaultValues prop.
import { FormProps, ValidatedForm } from "remix-validated-form";
type DeepPartial<T> = T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;
export default ValidatedForm as <DataType, Subaction extends string | undefined>(
props: Omit<FormProps<DataType, Subaction>, "defaultValues"> & {
defaultValues?: DeepPartial<FormProps<DataType, Subaction>["defaultValues"]>;
}
) => JSX.Element;
Why should this feature be included?
So that the type matches the implementation
Useful for pre-filling more complex forms that use the nested object syntax
What is the new or updated feature that you are suggesting?
For the nested object syntax it would be handy to seed only a subset of the fields. For example, consider a todo app where we want to pre-fill the first todo based off a previous interaction
Functionally, it looks like
ValidatedForm
already works like this. Just the Typescript type need to be updated. As a work around in my codebase, I've been re-exporting theValidatedForm
component with aDeepPartial
type for thedefaultValues
prop.Why should this feature be included?