From 73ab95b8a35bb71c20fbe15b526f7a311ae7f60c Mon Sep 17 00:00:00 2001 From: lilia Date: Fri, 20 Nov 2015 16:10:00 -0800 Subject: [PATCH] Serialize search queries Fixes #395 // FREEBIE --- js/views/conversation_search_view.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index 9de916125..90ff6b831 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -21,7 +21,7 @@ this.$el.append(this.typeahead_view.el); this.initNewContact(); //this.listenTo(this.collection, 'reset', this.filterContacts); - + this.pending = Promise.resolve(); }, events: { @@ -38,8 +38,10 @@ } else { this.new_contact_view.$el.hide(); } - this.typeahead.search(query).then(function() { - this.typeahead_view.collection.reset(this.typeahead.models); + this.pending = this.pending.then(function() { + return this.typeahead.search(query).then(function() { + this.typeahead_view.collection.reset(this.typeahead.models); + }.bind(this)); }.bind(this)); this.trigger('show'); } else {