nl_tokens: We have some updates that are applied to the backed since last sync run . However those updates are not in the localDatasetClient yet ( they will in after next sync run ) . But those updates are applied on the client already . This means when we compute the delta between the client records and the localDatasetClient those changes will be reverted from the client . To avoid that we loop through those updates and remove them both from the clientRecords and localDatasetClient . This way there will be no delta for those records and the client will keep there records .
pl_tokens: function removeAppliedUpdates ( clientRecords , localDatasetClient , appliedUpdates ) { _ . each ( appliedUpdates , function ( update , recordUid ) { if ( clientRecords [ recordUid ] ) { delete clientRecords [ recordUid ] ; } if ( localDatasetClient [ recordUid ] ) { <mask> localDatasetClient [ recordUid ] ; } //cover the creation cases. The uid could change. Client may still have the old uid. if ( update . oldUid ) { var oldUid = update . oldUid ; if ( clientRecords [ oldUid ] ) { delete clientRecords [ oldUid ] ; } } } ) ; }