Fixes angular digest loop when note has more than 10 tags
This commit is contained in:
@@ -83,8 +83,8 @@ angular.module('app')
|
|||||||
|
|
||||||
this.setTags = function(tags) {
|
this.setTags = function(tags) {
|
||||||
if(initialLoad) {
|
if(initialLoad) {
|
||||||
initialLoad = false;
|
initialLoad = false;
|
||||||
this.selectTag(this.allTag);
|
this.selectTag(this.allTag);
|
||||||
} else {
|
} else {
|
||||||
if(tags && tags.length > 0) {
|
if(tags && tags.length > 0) {
|
||||||
this.selectTag(tags[0]);
|
this.selectTag(tags[0]);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ class Note extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addItemAsRelationship(item) {
|
addItemAsRelationship(item) {
|
||||||
|
this.savedTagsString = null;
|
||||||
|
|
||||||
if(item.content_type == "Tag") {
|
if(item.content_type == "Tag") {
|
||||||
if(!_.find(this.tags, item)) {
|
if(!_.find(this.tags, item)) {
|
||||||
this.tags.push(item);
|
this.tags.push(item);
|
||||||
@@ -42,6 +44,8 @@ class Note extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeItemAsRelationship(item) {
|
removeItemAsRelationship(item) {
|
||||||
|
this.savedTagsString = null;
|
||||||
|
|
||||||
if(item.content_type == "Tag") {
|
if(item.content_type == "Tag") {
|
||||||
_.pull(this.tags, item);
|
_.pull(this.tags, item);
|
||||||
}
|
}
|
||||||
@@ -49,6 +53,8 @@ class Note extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeAndDirtyAllRelationships() {
|
removeAndDirtyAllRelationships() {
|
||||||
|
this.savedTagsString = null;
|
||||||
|
|
||||||
this.tags.forEach(function(tag){
|
this.tags.forEach(function(tag){
|
||||||
_.pull(tag.notes, this);
|
_.pull(tag.notes, this);
|
||||||
tag.setDirty(true);
|
tag.setDirty(true);
|
||||||
@@ -57,6 +63,8 @@ class Note extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeReferencesNotPresentIn(references) {
|
removeReferencesNotPresentIn(references) {
|
||||||
|
this.savedTagsString = null;
|
||||||
|
|
||||||
super.removeReferencesNotPresentIn(references);
|
super.removeReferencesNotPresentIn(references);
|
||||||
|
|
||||||
var uuids = references.map(function(ref){return ref.uuid});
|
var uuids = references.map(function(ref){return ref.uuid});
|
||||||
@@ -108,6 +116,7 @@ class Note extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tagsString() {
|
tagsString() {
|
||||||
return Tag.arrayToDisplayString(this.tags);
|
this.savedTagsString = Tag.arrayToDisplayString(this.tags);
|
||||||
|
return this.savedTagsString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
%strong.medium Archived
|
%strong.medium Archived
|
||||||
|
|
||||||
.tags-string{"ng-if" => "ctrl.shouldShowTags(note)"}
|
.tags-string{"ng-if" => "ctrl.shouldShowTags(note)"}
|
||||||
.faded {{note.tagsString()}}
|
.faded {{note.savedTagsString || note.tagsString()}}
|
||||||
|
|
||||||
.name{"ng-if" => "note.title"}
|
.name{"ng-if" => "note.title"}
|
||||||
{{note.title}}
|
{{note.title}}
|
||||||
|
|||||||
Reference in New Issue
Block a user