@@ -172,34 +172,14 @@ function isMergeableObject<TObject extends Record<string, unknown>>(value: unkno
172172
173173/** Deep removes the nested null values from the given value. */
174174function removeNestedNullValues < TValue extends OnyxInput < OnyxKey > | null > ( value : TValue ) : TValue {
175- if ( value === null || value === undefined ) {
176- return value ;
175+ if ( typeof value === 'object' && ! Array . isArray ( value ) ) {
176+ return fastMerge ( value , value , {
177+ shouldRemoveNestedNulls : true ,
178+ objectRemovalMode : 'replace' ,
179+ } ) . result ;
177180 }
178181
179- if ( typeof value !== 'object' || Array . isArray ( value ) ) {
180- return value ;
181- }
182-
183- const result : Record < string , unknown > = { } ;
184-
185- // eslint-disable-next-line no-restricted-syntax, guard-for-in
186- for ( const key in value ) {
187- const propertyValue = value [ key ] ;
188-
189- if ( propertyValue === null || propertyValue === undefined ) {
190- // eslint-disable-next-line no-continue
191- continue ;
192- }
193-
194- if ( typeof propertyValue === 'object' && ! Array . isArray ( propertyValue ) ) {
195- const valueWithoutNestedNulls = removeNestedNullValues ( propertyValue ) ;
196- result [ key ] = valueWithoutNestedNulls ;
197- } else {
198- result [ key ] = propertyValue ;
199- }
200- }
201-
202- return result as TValue ;
182+ return value ;
203183}
204184
205185/** Formats the action name by uppercasing and adding the key if provided. */
0 commit comments