diff --git a/app/assets/javascripts/app/services/modelManager.js b/app/assets/javascripts/app/services/modelManager.js index 712e52aff..325f9f1ef 100644 --- a/app/assets/javascripts/app/services/modelManager.js +++ b/app/assets/javascripts/app/services/modelManager.js @@ -117,7 +117,7 @@ class ModelManager { items.forEach(function(item){ if(item.content_type == "Tag") { if(!_.find(this.tags, {uuid: item.uuid})) { - this.tags.unshift(item); + this.tags.splice(_.sortedIndexBy(this.tags, item, 'title'), 0, item); } } else if(item.content_type == "Note") { if(!_.find(this.notes, {uuid: item.uuid})) { @@ -128,7 +128,7 @@ class ModelManager { this._extensions.unshift(item); } } - }.bind(this)) + }.bind(this)); } addItem(item) {