Fix modelManager sync observer now being syncronous
This commit is contained in:
@@ -30,28 +30,30 @@ angular.module('app')
|
|||||||
|| syncEvent == "local-data-incremental-load") {
|
|| syncEvent == "local-data-incremental-load") {
|
||||||
this.tags = modelManager.tags;
|
this.tags = modelManager.tags;
|
||||||
this.smartTags = modelManager.getSmartTags();
|
this.smartTags = modelManager.getSmartTags();
|
||||||
|
if(this.noteCountsNeedReload) {
|
||||||
|
this.noteCountsNeedReload = false;
|
||||||
|
this.reloadNoteCounts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
modelManager.addItemSyncObserver("note-list", "*", (allItems, validItems, deletedItems, source, sourceKey) => {
|
modelManager.addItemSyncObserver("tags-list", "*", (allItems, validItems, deletedItems, source, sourceKey) => {
|
||||||
// recompute note counts
|
this.noteCountsNeedReload = true;
|
||||||
let tags = [];
|
});
|
||||||
if(this.tags) {
|
|
||||||
tags = tags.concat(this.tags);
|
|
||||||
}
|
|
||||||
if(this.smartTags) {
|
|
||||||
tags = tags.concat(this.smartTags);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(let tag of tags) {
|
this.reloadNoteCounts = function() {
|
||||||
var validNotes = SNNote.filterDummyNotes(tag.notes).filter(function(note){
|
let allTags = [];
|
||||||
|
if(this.tags) { allTags = allTags.concat(this.tags);}
|
||||||
|
if(this.smartTags) { allTags = allTags.concat(this.smartTags);}
|
||||||
|
|
||||||
|
for(let tag of allTags) {
|
||||||
|
var validNotes = SNNote.filterDummyNotes(tag.notes).filter((note) => {
|
||||||
return !note.archived && !note.content.trashed;
|
return !note.archived && !note.content.trashed;
|
||||||
});
|
});
|
||||||
|
|
||||||
tag.cachedNoteCount = validNotes.length;
|
tag.cachedNoteCount = validNotes.length;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
this.panelController = {};
|
this.panelController = {};
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
%lock-screen{"ng-if" => "needsUnlock", "on-success" => "onSuccessfulUnlock"}
|
%lock-screen{"ng-if" => "needsUnlock", "on-success" => "onSuccessfulUnlock"}
|
||||||
|
|
||||||
.app#app{"ng-if" => "!needsUnlock", "ng-class" => "appClass"}
|
.app#app{"ng-if" => "!needsUnlock", "ng-class" => "appClass"}
|
||||||
%tags-section{"save" => "tagsSave", "add-new" => "tagsAddNew", "selection-made" => "tagsSelectionMade",
|
%tags-section{"save" => "tagsSave", "add-new" => "tagsAddNew", "selection-made" => "tagsSelectionMade", "remove-tag" => "removeTag"}
|
||||||
"tags" => "tags", "remove-tag" => "removeTag"}
|
|
||||||
%notes-section{"add-new" => "notesAddNew", "selection-made" => "notesSelectionMade", "tag" => "selectedTag"}
|
%notes-section{"add-new" => "notesAddNew", "selection-made" => "notesSelectionMade", "tag" => "selectedTag"}
|
||||||
%editor-section{"note" => "selectedNote", "remove" => "deleteNote", "update-tags" => "updateTagsForNote"}
|
%editor-section{"note" => "selectedNote", "remove" => "deleteNote", "update-tags" => "updateTagsForNote"}
|
||||||
|
|
||||||
|
|||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -5724,9 +5724,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"snjs": {
|
"snjs": {
|
||||||
"version": "0.2.6",
|
"version": "0.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/snjs/-/snjs-0.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/snjs/-/snjs-0.2.7.tgz",
|
||||||
"integrity": "sha512-nBWwzNcOKtCj6Z0f0buD/vswd3agU+sI2KHWQuUn1tuhNoGdzh20DgjcmxEEmW7QiiEkvZHDL/TC8N47tx66SQ==",
|
"integrity": "sha512-MPegTzgrQY5xh24jBsAQKqxiCpLDDtgelcrv4G1Xz6yZqH2H2WrUTr7YSE1QCPbKHMXvuX7kn/cTDchyhEdESQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"source-map": {
|
"source-map": {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"sn-stylekit": "2.0.15",
|
"sn-stylekit": "2.0.15",
|
||||||
"snjs": "0.2.6",
|
"snjs": "0.2.7",
|
||||||
"standard-file-js": "0.3.63"
|
"standard-file-js": "0.3.63"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user