@@ -155,6 +155,8 @@ export class FormState<T, State = DefaultState, Error extends string = DefaultEr
155155 notifyParent : boolean = true ,
156156 fireAny : boolean = true
157157 ) {
158+ if ( key === "author" ) console . trace ( "setValueInternal" , key , value , dirty ) ;
159+
158160 let valueMap = isDefault ? this . defaultValues : this . values ;
159161 if ( value === undefined ) {
160162 if ( Array . isArray ( valueMap ) ) valueMap . splice ( key as number , 1 ) ;
@@ -240,7 +242,7 @@ export class FormState<T, State = DefaultState, Error extends string = DefaultEr
240242 * @param notifyChild Should this form notify the child form about this change?
241243 * @param notifyParent Should this form notify the parent form about this change?
242244 */
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 ) {
244246 // No set is used because this could cause problems with array keys, which must always be in the right order
245247 let keys = Object . keys ( isDefault ? this . defaultValues : this . values ) ;
246248 let newKeys = Object . keys ( values ) ;
@@ -274,7 +276,7 @@ export class FormState<T, State = DefaultState, Error extends string = DefaultEr
274276 * @param notifyChild Should this form notify the child form about this change?
275277 * @param notifyParent Should this form notify the parent form about this change?
276278 */
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 ) {
278280 this . setValues ( values , false , true , notifyChild , notifyParent ) ;
279281 this . setValues ( values , validate , false , notifyChild , notifyParent ) ;
280282 }
@@ -541,9 +543,10 @@ export class ChildFormState<Parent, Key extends keyof Parent, ParentState, Paren
541543 }
542544
543545 protected updateParentValues ( isDefault : boolean , validate : boolean | undefined ) {
546+ let values = isDefault ? memberCopy ( this . defaultValues ) : memberCopy ( this . values ) ;
544547 this . parent . setValueInternal (
545548 this . name ,
546- isDefault ? memberCopy ( this . defaultValues ) : memberCopy ( this . values ) ,
549+ Object . keys ( values ) . length > 0 ? values : undefined ,
547550 this . dirty ,
548551 validate ,
549552 isDefault ,
0 commit comments