Handle case where offline item id alternates but does not remove old object from active editor session
This commit is contained in:
@@ -42,7 +42,18 @@ angular.module('app')
|
|||||||
|
|
||||||
modelManager.addItemSyncObserver("component-manager", "Note", (allItems, validItems, deletedItems, source) => {
|
modelManager.addItemSyncObserver("component-manager", "Note", (allItems, validItems, deletedItems, source) => {
|
||||||
if(!this.note) { return; }
|
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) => {
|
var matchingNote = allItems.find((item) => {
|
||||||
return item.uuid == this.note.uuid;
|
return item.uuid == this.note.uuid;
|
||||||
@@ -52,12 +63,8 @@ angular.module('app')
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(matchingNote.deleted) {
|
// Update tags
|
||||||
$rootScope.notifyDelete();
|
this.loadTagsString();
|
||||||
} else {
|
|
||||||
// Update tags
|
|
||||||
this.loadTagsString();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.noteDidChange = function(note, oldNote) {
|
this.noteDidChange = function(note, oldNote) {
|
||||||
|
|||||||
Reference in New Issue
Block a user