@@ -91,9 +91,9 @@ export class MutationResult {
9191 * containing field transforms has been committed. Contains one FieldValue
9292 * for each FieldTransform that was in the mutation.
9393 *
94- * Will be null if the mutation did not contain any field transforms.
94+ * Will be empty if the mutation did not contain any field transforms.
9595 */
96- readonly transformResults : Array < ProtoValue | null > | null
96+ readonly transformResults : Array < ProtoValue | null >
9797 ) { }
9898}
9999
@@ -434,18 +434,16 @@ function applySetMutationToRemoteDocument(
434434 // remote document the server has accepted the mutation so the precondition
435435 // must have held.
436436 let newData = mutation . value ;
437- if ( mutationResult . transformResults ) {
438- const transformResults = serverTransformResults (
439- mutation . fieldTransforms ,
440- maybeDoc ,
441- mutationResult . transformResults
442- ) ;
443- newData = transformObject (
444- mutation . fieldTransforms ,
445- newData ,
446- transformResults
447- ) ;
448- }
437+ const transformResults = serverTransformResults (
438+ mutation . fieldTransforms ,
439+ maybeDoc ,
440+ mutationResult . transformResults
441+ ) ;
442+ newData = transformObject (
443+ mutation . fieldTransforms ,
444+ newData ,
445+ transformResults
446+ ) ;
449447
450448 return new Document ( mutation . key , mutationResult . version , newData , {
451449 hasCommittedMutations : true
@@ -519,13 +517,11 @@ function applyPatchMutationToRemoteDocument(
519517 return new UnknownDocument ( mutation . key , mutationResult . version ) ;
520518 }
521519
522- const transformResults = mutationResult . transformResults
523- ? serverTransformResults (
524- mutation . fieldTransforms ,
525- maybeDoc ,
526- mutationResult . transformResults
527- )
528- : [ ] ;
520+ const transformResults = serverTransformResults (
521+ mutation . fieldTransforms ,
522+ maybeDoc ,
523+ mutationResult . transformResults
524+ ) ;
529525 const newData = patchDocument ( mutation , maybeDoc , transformResults ) ;
530526 return new Document ( mutation . key , mutationResult . version , newData , {
531527 hasCommittedMutations : true
@@ -701,7 +697,7 @@ function applyDeleteMutationToRemoteDocument(
701697 mutationResult : MutationResult
702698) : NoDocument {
703699 debugAssert (
704- mutationResult . transformResults == null ,
700+ mutationResult . transformResults . length === 0 ,
705701 'Transform results received by DeleteMutation.'
706702 ) ;
707703
0 commit comments