mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Only search when the value changes, not key press
This commit is contained in:
parent
e91379916b
commit
332bf311c7
@ -1,5 +1,7 @@
|
|||||||
import { default as computed } from 'ember-addons/ember-computed-decorators';
|
import { default as computed } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
|
let lastSearch;
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
_q: null,
|
_q: null,
|
||||||
searching: false,
|
searching: false,
|
||||||
@ -44,8 +46,12 @@ export default Ember.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
this.set('searching', true);
|
const q = this.get('q');
|
||||||
Ember.run.debounce(this, this._performSearch, 400);
|
if (q !== lastSearch) {
|
||||||
|
this.set('searching', true);
|
||||||
|
Ember.run.debounce(this, this._performSearch, 400);
|
||||||
|
lastSearch = q;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user