File tree 1 file changed +7
-2
lines changed
packages/firestore/src/model 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ export function calculateOverlayMutation(
242
242
let maskSet = new SortedSet < FieldPath > ( FieldPath . comparator ) ;
243
243
mask . fields . forEach ( path => {
244
244
if ( ! maskSet . has ( path ) ) {
245
- const value = docValue . field ( path ) ;
245
+ let value = docValue . field ( path ) ;
246
246
// If we are deleting a nested field, we take the immediate parent as
247
247
// the mask used to construct the resulting mutation.
248
248
// Justification: Nested fields can create parent fields implicitly. If
@@ -254,8 +254,13 @@ export function calculateOverlayMutation(
254
254
// mutation would miss `foo`.
255
255
if ( value === null && path . length > 1 ) {
256
256
path = path . popLast ( ) ;
257
+ value = docValue . field ( path ) ;
258
+ }
259
+ if ( value === null ) {
260
+ patchValue . delete ( path ) ;
261
+ } else {
262
+ patchValue . set ( path , value ) ;
257
263
}
258
- patchValue . set ( path , docValue . field ( path ) ! ) ;
259
264
maskSet = maskSet . add ( path ) ;
260
265
}
261
266
} ) ;
You can’t perform that action at this time.
0 commit comments