@@ -359,21 +359,27 @@ export default class SyncProcess {
359359 mappingsSnapshot = this . mappings . getSnapshot ( )
360360 Logger . log ( 'Mapping server plan' )
361361
362+ // skipErroneousActions on UPDATE/REMOVE: an UPDATE or REMOVE whose item can no longer
363+ // be mapped to the target references something that doesn't exist there, so it's moot —
364+ // drop it instead of throwing MappingFailureError (which forces a cache reset + from-scratch
365+ // resync that re-applies already-committed actions and duplicates them on non-atomic servers).
366+ // CREATE is deliberately left throwing: dropping an unmappable CREATE would silently lose
367+ // the new item rather than being a no-op.
362368 this . serverPlanStage2 = {
363369 CREATE : this . serverPlanStage1 . CREATE . map ( mappingsSnapshot , ItemLocation . SERVER ) ,
364- UPDATE : this . serverPlanStage1 . UPDATE . map ( mappingsSnapshot , ItemLocation . SERVER ) ,
370+ UPDATE : this . serverPlanStage1 . UPDATE . map ( mappingsSnapshot , ItemLocation . SERVER , ( ) => true , true ) ,
365371 MOVE : this . serverPlanStage1 . MOVE ,
366- REMOVE : this . serverPlanStage1 . REMOVE . map ( mappingsSnapshot , ItemLocation . SERVER ) ,
372+ REMOVE : this . serverPlanStage1 . REMOVE . map ( mappingsSnapshot , ItemLocation . SERVER , ( ) => true , true ) ,
367373 REORDER : this . serverPlanStage1 . REORDER ,
368374 }
369375
370376 Logger . log ( 'Mapping local plan' )
371377
372378 this . localPlanStage2 = {
373379 CREATE : this . localPlanStage1 . CREATE . map ( mappingsSnapshot , ItemLocation . LOCAL ) ,
374- UPDATE : this . localPlanStage1 . UPDATE . map ( mappingsSnapshot , ItemLocation . LOCAL ) ,
380+ UPDATE : this . localPlanStage1 . UPDATE . map ( mappingsSnapshot , ItemLocation . LOCAL , ( ) => true , true ) ,
375381 MOVE : this . localPlanStage1 . MOVE ,
376- REMOVE : this . localPlanStage1 . REMOVE . map ( mappingsSnapshot , ItemLocation . LOCAL ) ,
382+ REMOVE : this . localPlanStage1 . REMOVE . map ( mappingsSnapshot , ItemLocation . LOCAL , ( ) => true , true ) ,
377383 REORDER : this . localPlanStage1 . REORDER ,
378384 }
379385 }
0 commit comments