File tree 1 file changed +10
-2
lines changed
packages/app-headless-cms/src/admin/components/ContentEntryForm 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -57,19 +57,27 @@ export function useBind({ Bind, field }: UseBindProps) {
57
57
const isMultipleValues = index === - 1 && field . multipleValues ;
58
58
const inputValidators = isMultipleValues ? listValidators : validators ;
59
59
60
+ const defaultValueFromSettings = field . settings
61
+ ? ( field . settings . defaultValue as any )
62
+ : null ;
63
+
64
+ const indexDefaultValue = field . multipleValues
65
+ ? ( defaultValueFromSettings ?? [ ] ) [ index ]
66
+ : null ;
67
+
60
68
memoizedBindComponents . current [ componentId ] = function UseBind ( params : UseBindParams ) {
61
69
const {
62
70
name : childName ,
63
71
validators : childValidators ,
64
72
children,
65
- defaultValue
73
+ defaultValue = index === - 1 ? defaultValueFromSettings : indexDefaultValue
66
74
} = params ;
67
75
68
76
return (
69
77
< Bind
70
78
name = { childName || name }
71
79
validators = { childValidators || inputValidators }
72
- defaultValue = { ! isMultipleValues ? defaultValue : null }
80
+ defaultValue = { defaultValue ?? undefined }
73
81
>
74
82
{ bind => {
75
83
// Multiple-values functions below.
You can’t perform that action at this time.
0 commit comments