run search after you've stopped typing for 200ms instead of every 500ms
This commit is contained in:
parent
f34855573e
commit
d2dd1bae13
1 changed files with 4 additions and 7 deletions
|
@ -21,7 +21,7 @@ import { _t } from '../../languageHandler';
|
||||||
import { KeyCode } from '../../Keyboard';
|
import { KeyCode } from '../../Keyboard';
|
||||||
import sdk from '../../index';
|
import sdk from '../../index';
|
||||||
import dis from '../../dispatcher';
|
import dis from '../../dispatcher';
|
||||||
import rate_limited_func from '../../ratelimitedfunc';
|
import { debounce } from 'lodash';
|
||||||
import AccessibleButton from '../../components/views/elements/AccessibleButton';
|
import AccessibleButton from '../../components/views/elements/AccessibleButton';
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
|
@ -67,12 +67,9 @@ module.exports = React.createClass({
|
||||||
this.onSearch();
|
this.onSearch();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSearch: new rate_limited_func(
|
onSearch: debounce(function() {
|
||||||
function() {
|
|
||||||
this.props.onSearch(this.refs.search.value);
|
this.props.onSearch(this.refs.search.value);
|
||||||
},
|
}, 200, {trailing: true}),
|
||||||
500,
|
|
||||||
),
|
|
||||||
|
|
||||||
_onKeyDown: function(ev) {
|
_onKeyDown: function(ev) {
|
||||||
switch (ev.keyCode) {
|
switch (ev.keyCode) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue