Serialize search queries

Fixes #395

// FREEBIE
This commit is contained in:
lilia 2015-11-20 16:10:00 -08:00
parent 798d1a4212
commit 73ab95b8a3

View file

@ -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 {