about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-19 01:50:56 +0200
committerGitHub <noreply@github.com>2017-06-19 01:50:56 +0200
commitaebebdc5d1967e2110a9caafc3238c8b8ec055c4 (patch)
tree63375f6624c5fd64bff9be8cfa19178418b5139d
parent05e4728de781209d13405240eca0dd4f3ef6baa8 (diff)
Debounce autosuggestions (#3836)
* Debounce autosuggestions

* Remove duplicate import
-rw-r--r--app/javascript/mastodon/features/compose/components/compose_form.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
index 621ec43ab..8da3f8046 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -74,9 +74,9 @@ class ComposeForm extends ImmutablePureComponent {
     this.props.onClearSuggestions();
   }
 
-  onSuggestionsFetchRequested = (token) => {
+  onSuggestionsFetchRequested = debounce((token) => {
     this.props.onFetchSuggestions(token);
-  }
+  }, 500, { trailing: true })
 
   onSuggestionSelected = (tokenStart, token, value) => {
     this._restoreCaret = null;