File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
frontend/packages/pydantic-forms/src/components/fields Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export const ArrayField = ({ pydanticFormField }: PydanticFormElementProps) => {
7676 < div
7777 onClick = { ( ) => {
7878 append ( {
79- [ arrayName ] : undefined ,
79+ [ arrayName ] : arrayItem . default ?? undefined ,
8080 } ) ;
8181 } }
8282 style = { {
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ export const IntegerField = ({
1818 onChange ( value ) ;
1919 } }
2020 disabled = { disabled }
21- value = { ! isObject ( value ) ? value : '' } // Value can be an object when it is created from an ArrayField
21+ // Value will be an object when it is added by an array field. We do this be able to add more than one empty field
22+ value = { isObject ( value ) ? undefined : value }
2223 type = "number"
2324 style = { {
2425 padding : '8px' ,
Original file line number Diff line number Diff line change 55 */
66import React from 'react' ;
77
8+ import { isObject } from 'lodash' ;
9+
810import { PydanticFormControlledElementProps } from '@/types' ;
911
1012export const TextField = ( {
@@ -19,7 +21,8 @@ export const TextField = ({
1921 onChange ( t . currentTarget . value ) ;
2022 } }
2123 disabled = { disabled }
22- value = { value }
24+ // Value will be an object when it is added by an array field. We do this be able to add more than one empty field
25+ value = { isObject ( value ) ? '' : value }
2326 type = "text"
2427 style = { {
2528 padding : '8px' ,
You can’t perform that action at this time.
0 commit comments