From 47c14021b39f92327a74c4f92c38847ebc6a9ad0 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 13 Feb 2019 20:32:50 +0100 Subject: [PATCH] use throttle as its more responsive --- src/components/structures/SearchBox.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index 2f777c1163..10628ccd13 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -21,7 +21,7 @@ import { _t } from '../../languageHandler'; import { KeyCode } from '../../Keyboard'; import sdk from '../../index'; import dis from '../../dispatcher'; -import { debounce } from 'lodash'; +import { throttle } from 'lodash'; import AccessibleButton from '../../components/views/elements/AccessibleButton'; module.exports = React.createClass({ @@ -67,9 +67,9 @@ module.exports = React.createClass({ this.onSearch(); }, - onSearch: debounce(function() { + onSearch: throttle(function() { this.props.onSearch(this.refs.search.value); - }, 200, {trailing: true}), + }, 200, {trailing: true, leading: true}), _onKeyDown: function(ev) { switch (ev.keyCode) {