about summary refs log tree commit diff
path: root/app/assets
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-13 13:13:36 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-13 13:13:36 +0100
commitc4eb63c1d41c613ceacf668cd7d9443c4c823963 (patch)
tree7bb30a095cd2dc629ad7d858ee1514bf1d5a330e /app/assets
parentf0bdfadab7e5293b3f7855b6707a1fa95ea76ca6 (diff)
Debounce autosuggestions requests
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/components/features/compose/components/search.jsx2
-rw-r--r--app/assets/javascripts/components/features/ui/components/compose_form.jsx2
2 files changed, 4 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/features/compose/components/search.jsx b/app/assets/javascripts/components/features/compose/components/search.jsx
index e81771e6a..93f7df775 100644
--- a/app/assets/javascripts/components/features/compose/components/search.jsx
+++ b/app/assets/javascripts/components/features/compose/components/search.jsx
@@ -2,6 +2,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
 import ImmutablePropTypes from 'react-immutable-proptypes';
 import Autosuggest from 'react-autosuggest';
 import AutosuggestAccountContainer from '../containers/autosuggest_account_container';
+import { debounce } from 'react-decoration';
 
 const getSuggestionValue = suggestion => suggestion.value;
 
@@ -77,6 +78,7 @@ const Search = React.createClass({
     this.props.onClear();
   },
 
+  @debounce(500)
   onSuggestionsFetchRequested ({ value }) {
     value = value.replace('#', '');
     this.props.onFetch(value.trim());
diff --git a/app/assets/javascripts/components/features/ui/components/compose_form.jsx b/app/assets/javascripts/components/features/ui/components/compose_form.jsx
index 20dc32709..aef228d58 100644
--- a/app/assets/javascripts/components/features/ui/components/compose_form.jsx
+++ b/app/assets/javascripts/components/features/ui/components/compose_form.jsx
@@ -6,6 +6,7 @@ import ReplyIndicator from './reply_indicator';
 import UploadButton from './upload_button';
 import Autosuggest from 'react-autosuggest';
 import AutosuggestAccountContainer from '../../compose/containers/autosuggest_account_container';
+import { debounce } from 'react-decoration';
 
 const getTokenForSuggestions = (str, caretPosition) => {
   let word;
@@ -104,6 +105,7 @@ const ComposeForm = React.createClass({
     this.props.onClearSuggestions();
   },
 
+  @debounce(500)
   onSuggestionsFetchRequested ({ value }) {
     const textarea = this.autosuggest.input;