File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export class ArrayField extends Component {
20
20
this . state = {
21
21
// Chosen because it will never cross with 0-indexed pre-existing keys.
22
22
nextKey : - 1 ,
23
+ hasBeenShown : false ,
23
24
} ;
24
25
}
25
26
@@ -41,10 +42,17 @@ export class ArrayField extends Component {
41
42
*/
42
43
getValues = ( values , fieldPath ) => {
43
44
const { requiredOptions, defaultNewValue, showEmptyValue } = this . props ;
45
+ const { hasBeenShown } = this . state ;
44
46
const existingValues = getIn ( values , fieldPath , [ ] ) ;
45
47
46
- if ( _isEmpty ( requiredOptions ) && _isEmpty ( existingValues ) && showEmptyValue ) {
48
+ if (
49
+ ! hasBeenShown &&
50
+ _isEmpty ( requiredOptions ) &&
51
+ _isEmpty ( existingValues ) &&
52
+ showEmptyValue
53
+ ) {
47
54
existingValues . push ( { __key : existingValues . length , ...defaultNewValue } ) ;
55
+ this . setState ( { hasBeenShown : true } ) ;
48
56
}
49
57
50
58
for ( const requiredOption of requiredOptions ) {
You can’t perform that action at this time.
0 commit comments