@@ -155,6 +155,8 @@ export class FormState<T, State = DefaultState, Error extends string = DefaultEr
155
155
notifyParent : boolean = true ,
156
156
fireAny : boolean = true
157
157
) {
158
+ if ( key === "author" ) console . trace ( "setValueInternal" , key , value , dirty ) ;
159
+
158
160
let valueMap = isDefault ? this . defaultValues : this . values ;
159
161
if ( value === undefined ) {
160
162
if ( Array . isArray ( valueMap ) ) valueMap . splice ( key as number , 1 ) ;
@@ -240,7 +242,7 @@ export class FormState<T, State = DefaultState, Error extends string = DefaultEr
240
242
* @param notifyChild Should this form notify the child form about this change?
241
243
* @param notifyParent Should this form notify the parent form about this change?
242
244
*/
243
- public setValues ( values : T , validate ?: boolean , isDefault : boolean = false , notifyChild : boolean = true , notifyParent : boolean = true ) {
245
+ public setValues ( values : Partial < T > , validate ?: boolean , isDefault : boolean = false , notifyChild : boolean = true , notifyParent : boolean = true ) {
244
246
// No set is used because this could cause problems with array keys, which must always be in the right order
245
247
let keys = Object . keys ( isDefault ? this . defaultValues : this . values ) ;
246
248
let newKeys = Object . keys ( values ) ;
@@ -274,7 +276,7 @@ export class FormState<T, State = DefaultState, Error extends string = DefaultEr
274
276
* @param notifyChild Should this form notify the child form about this change?
275
277
* @param notifyParent Should this form notify the parent form about this change?
276
278
*/
277
- public setDefaultValues ( values : T , validate : boolean = true , notifyChild : boolean = true , notifyParent : boolean = true ) {
279
+ public setDefaultValues ( values : Partial < T > , validate : boolean = true , notifyChild : boolean = true , notifyParent : boolean = true ) {
278
280
this . setValues ( values , false , true , notifyChild , notifyParent ) ;
279
281
this . setValues ( values , validate , false , notifyChild , notifyParent ) ;
280
282
}
@@ -541,9 +543,10 @@ export class ChildFormState<Parent, Key extends keyof Parent, ParentState, Paren
541
543
}
542
544
543
545
protected updateParentValues ( isDefault : boolean , validate : boolean | undefined ) {
546
+ let values = isDefault ? memberCopy ( this . defaultValues ) : memberCopy ( this . values ) ;
544
547
this . parent . setValueInternal (
545
548
this . name ,
546
- isDefault ? memberCopy ( this . defaultValues ) : memberCopy ( this . values ) ,
549
+ Object . keys ( values ) . length > 0 ? values : undefined ,
547
550
this . dirty ,
548
551
validate ,
549
552
isDefault ,
0 commit comments