FIX: on enter we would double search on full page search

This commit is contained in:
Sam 2015-09-09 12:00:31 +10:00
parent 5eb1fb3bfd
commit 5ed7663a63
1 changed files with 6 additions and 1 deletions

View File

@ -64,6 +64,11 @@ export default Ember.Controller.extend({
canBulkSelect: Em.computed.alias('currentUser.staff'), canBulkSelect: Em.computed.alias('currentUser.staff'),
search(){ search(){
if (this._searching) {
return;
}
this._searching = true;
const router = Discourse.__container__.lookup('router:main'); const router = Discourse.__container__.lookup('router:main');
this.set("q", this.get("searchTerm")); this.set("q", this.get("searchTerm"));
@ -85,7 +90,7 @@ export default Ember.Controller.extend({
const model = translateResults(results) || {}; const model = translateResults(results) || {};
router.transientCache('lastSearch', { searchKey, model }, 5); router.transientCache('lastSearch', { searchKey, model }, 5);
this.set("model", model); this.set("model", model);
}); }).finally(() => {this._searching = false});
}, },
actions: { actions: {