]> cat aescling's git repositories - mastodon.git/commitdiff
Debounce autosuggestions (#3836)
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 18 Jun 2017 23:50:56 +0000 (01:50 +0200)
committerGitHub <noreply@github.com>
Sun, 18 Jun 2017 23:50:56 +0000 (01:50 +0200)
* Debounce autosuggestions

* Remove duplicate import

app/javascript/mastodon/features/compose/components/compose_form.js

index 621ec43abb1ca229c736d3ee31c5a1153c1e31a6..8da3f8046b49b3faea00e0c9451e58e49049ea2e 100644 (file)
@@ -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;