I've hit a situation where I define the values in the schema, which is stored in a static file, but I want to override the default values via fieldConfig.inputProps which I feel should get priority
if (
(defaultValue === null || defaultValue === "") &&
fieldConfig?.[key]?.inputProps
) {
defaultValue = (fieldConfig?.[key]?.inputProps as unknown as any)
.defaultValue;
}
I would change this to:
if ((fieldConfig?.[key]?.inputProps as unknown as any)?.defaultValue) {
defaultValue = (fieldConfig?.[key]?.inputProps as unknown as any)
.defaultValue
}
This way the inputProps will get the highest prio and override the schema default value. What do you think @vantezzen ?
I've hit a situation where I define the values in the schema, which is stored in a static file, but I want to override the default values via fieldConfig.inputProps which I feel should get priority
I would suggest the following change here:
https://github.com/vantezzen/auto-form/blob/0143f43b42e0081b5f3dae728f2c9eb1d49964f3/src/components/ui/auto-form/utils.ts#L105
Instead of
I would change this to:
This way the inputProps will get the highest prio and override the schema default value. What do you think @vantezzen ?