Fixes angular digest loop when note has more than 10 tags

This commit is contained in:
Mo Bitar
2018-02-18 14:15:03 -06:00
parent f260476269
commit 4289d4806d
3 changed files with 13 additions and 4 deletions

View File

@@ -83,8 +83,8 @@ angular.module('app')
this.setTags = function(tags) {
if(initialLoad) {
initialLoad = false;
this.selectTag(this.allTag);
initialLoad = false;
this.selectTag(this.allTag);
} else {
if(tags && tags.length > 0) {
this.selectTag(tags[0]);

View File

@@ -33,6 +33,8 @@ class Note extends Item {
}
addItemAsRelationship(item) {
this.savedTagsString = null;
if(item.content_type == "Tag") {
if(!_.find(this.tags, item)) {
this.tags.push(item);
@@ -42,6 +44,8 @@ class Note extends Item {
}
removeItemAsRelationship(item) {
this.savedTagsString = null;
if(item.content_type == "Tag") {
_.pull(this.tags, item);
}
@@ -49,6 +53,8 @@ class Note extends Item {
}
removeAndDirtyAllRelationships() {
this.savedTagsString = null;
this.tags.forEach(function(tag){
_.pull(tag.notes, this);
tag.setDirty(true);
@@ -57,6 +63,8 @@ class Note extends Item {
}
removeReferencesNotPresentIn(references) {
this.savedTagsString = null;
super.removeReferencesNotPresentIn(references);
var uuids = references.map(function(ref){return ref.uuid});
@@ -108,6 +116,7 @@ class Note extends Item {
}
tagsString() {
return Tag.arrayToDisplayString(this.tags);
this.savedTagsString = Tag.arrayToDisplayString(this.tags);
return this.savedTagsString;
}
}

View File

@@ -55,7 +55,7 @@
%strong.medium Archived
.tags-string{"ng-if" => "ctrl.shouldShowTags(note)"}
.faded {{note.tagsString()}}
.faded {{note.savedTagsString || note.tagsString()}}
.name{"ng-if" => "note.title"}
{{note.title}}