@@ -435,40 +435,46 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
435
435
applyRemoteEvent ( remoteEvent : RemoteEvent ) : Promise < void > {
436
436
this . assertSubscribed ( 'applyRemoteEvent()' ) ;
437
437
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
+ }
467
473
}
468
- }
469
- } ) ;
470
- return this . emitNewSnapsAndNotifyLocalStore ( changes , remoteEvent ) ;
471
- } ) ;
474
+ ) ;
475
+ return this . emitNewSnapsAndNotifyLocalStore ( changes , remoteEvent ) ;
476
+ } )
477
+ . catch ( err => this . ignoreIfPrimaryLeaseLoss ( err ) ) ;
472
478
}
473
479
474
480
/**
0 commit comments