Skip to content

Commit 5c56479

Browse files
[AUTOMATED]: Prettier Code Styling
1 parent e203796 commit 5c56479

File tree

1 file changed

+39
-33
lines changed

1 file changed

+39
-33
lines changed

packages/firestore/src/core/sync_engine.ts

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -435,40 +435,46 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
435435
applyRemoteEvent(remoteEvent: RemoteEvent): Promise<void> {
436436
this.assertSubscribed('applyRemoteEvent()');
437437

438-
return this.localStore.applyRemoteEvent(remoteEvent).then(changes => {
439-
// Update `receivedDocument` as appropriate for any limbo targets.
440-
objUtils.forEach(remoteEvent.targetChanges, (targetId, targetChange) => {
441-
const limboResolution = this.limboResolutionsByTarget[targetId];
442-
if (limboResolution) {
443-
// Since this is a limbo resolution lookup, it's for a single document
444-
// and it could be added, modified, or removed, but not a combination.
445-
assert(
446-
targetChange.addedDocuments.size +
447-
targetChange.modifiedDocuments.size +
448-
targetChange.removedDocuments.size <=
449-
1,
450-
'Limbo resolution for single document contains multiple changes.'
451-
);
452-
if (targetChange.addedDocuments.size > 0) {
453-
limboResolution.receivedDocument = true;
454-
} else if (targetChange.modifiedDocuments.size > 0) {
455-
assert(
456-
limboResolution.receivedDocument,
457-
'Received change for limbo target document without add.'
458-
);
459-
} else if (targetChange.removedDocuments.size > 0) {
460-
assert(
461-
limboResolution.receivedDocument,
462-
'Received remove for limbo target document without add.'
463-
);
464-
limboResolution.receivedDocument = false;
465-
} else {
466-
// This was probably just a CURRENT targetChange or similar.
438+
return this.localStore
439+
.applyRemoteEvent(remoteEvent)
440+
.then(changes => {
441+
// Update `receivedDocument` as appropriate for any limbo targets.
442+
objUtils.forEach(
443+
remoteEvent.targetChanges,
444+
(targetId, targetChange) => {
445+
const limboResolution = this.limboResolutionsByTarget[targetId];
446+
if (limboResolution) {
447+
// Since this is a limbo resolution lookup, it's for a single document
448+
// and it could be added, modified, or removed, but not a combination.
449+
assert(
450+
targetChange.addedDocuments.size +
451+
targetChange.modifiedDocuments.size +
452+
targetChange.removedDocuments.size <=
453+
1,
454+
'Limbo resolution for single document contains multiple changes.'
455+
);
456+
if (targetChange.addedDocuments.size > 0) {
457+
limboResolution.receivedDocument = true;
458+
} else if (targetChange.modifiedDocuments.size > 0) {
459+
assert(
460+
limboResolution.receivedDocument,
461+
'Received change for limbo target document without add.'
462+
);
463+
} else if (targetChange.removedDocuments.size > 0) {
464+
assert(
465+
limboResolution.receivedDocument,
466+
'Received remove for limbo target document without add.'
467+
);
468+
limboResolution.receivedDocument = false;
469+
} else {
470+
// This was probably just a CURRENT targetChange or similar.
471+
}
472+
}
467473
}
468-
}
469-
});
470-
return this.emitNewSnapsAndNotifyLocalStore(changes, remoteEvent);
471-
});
474+
);
475+
return this.emitNewSnapsAndNotifyLocalStore(changes, remoteEvent);
476+
})
477+
.catch(err => this.ignoreIfPrimaryLeaseLoss(err));
472478
}
473479

474480
/**

0 commit comments

Comments
 (0)