Handle case where offline item id alternates but does not remove old object from active editor session

This commit is contained in:
Mo Bitar
2018-05-16 11:50:00 -05:00
parent 53f75c7fe2
commit 5be3c5eab3

View File

@@ -42,7 +42,18 @@ angular.module('app')
modelManager.addItemSyncObserver("component-manager", "Note", (allItems, validItems, deletedItems, source) => {
if(!this.note) { return; }
if(!ModelManager.isMappingSourceRetrieved(source)) {return;}
// Before checking if isMappingSourceRetrieved, we check if this item was deleted via a local source,
// such as alternating uuids during sign in. Otherwise, we only want to make interface updates if it's a
// remote retrieved source.
if(this.note.deleted) {
$rootScope.notifyDelete();
return;
}
if(!ModelManager.isMappingSourceRetrieved(source)) {
return;
}
var matchingNote = allItems.find((item) => {
return item.uuid == this.note.uuid;
@@ -52,12 +63,8 @@ angular.module('app')
return;
}
if(matchingNote.deleted) {
$rootScope.notifyDelete();
} else {
// Update tags
this.loadTagsString();
}
// Update tags
this.loadTagsString();
});
this.noteDidChange = function(note, oldNote) {