about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/features/compose/components/compose_form.js5
-rw-r--r--app/javascript/mastodon/features/ui/containers/status_list_container.js17
-rw-r--r--app/javascript/mastodon/features/ui/index.js5
3 files changed, 11 insertions, 16 deletions
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
index 0b9c097e3..2a93f2e43 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -5,7 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
 import PropTypes from 'prop-types';
 import ReplyIndicatorContainer from '../containers/reply_indicator_container';
 import AutosuggestTextarea from '../../../components/autosuggest_textarea';
-import { debounce } from 'react-decoration';
+import { debounce } from 'lodash';
 import UploadButtonContainer from '../containers/upload_button_container';
 import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
 import Toggle from 'react-toggle';
@@ -33,7 +33,7 @@ class ComposeForm extends ImmutablePureComponent {
     this.handleKeyDown = this.handleKeyDown.bind(this);
     this.handleSubmit = this.handleSubmit.bind(this);
     this.onSuggestionsClearRequested = this.onSuggestionsClearRequested.bind(this);
-    this.onSuggestionsFetchRequested = this.onSuggestionsFetchRequested.bind(this);
+    this.onSuggestionsFetchRequested = debounce(this.onSuggestionsFetchRequested.bind(this), 500);
     this.onSuggestionSelected = this.onSuggestionSelected.bind(this);
     this.handleChangeSpoilerText = this.handleChangeSpoilerText.bind(this);
     this.setAutosuggestTextarea = this.setAutosuggestTextarea.bind(this);
@@ -59,7 +59,6 @@ class ComposeForm extends ImmutablePureComponent {
     this.props.onClearSuggestions();
   }
 
-  @debounce(500)
   onSuggestionsFetchRequested (token) {
     this.props.onFetchSuggestions(token);
   }
diff --git a/app/javascript/mastodon/features/ui/containers/status_list_container.js b/app/javascript/mastodon/features/ui/containers/status_list_container.js
index 131f5192a..e0e01cf18 100644
--- a/app/javascript/mastodon/features/ui/containers/status_list_container.js
+++ b/app/javascript/mastodon/features/ui/containers/status_list_container.js
@@ -3,7 +3,7 @@ import StatusList from '../../../components/status_list';
 import { expandTimeline, scrollTopTimeline } from '../../../actions/timelines';
 import Immutable from 'immutable';
 import { createSelector } from 'reselect';
-import { debounce } from 'react-decoration';
+import { debounce } from 'lodash';
 
 const makeGetStatusIds = () => createSelector([
   (state, { type }) => state.getIn(['settings', type], Immutable.Map()),
@@ -53,21 +53,18 @@ const makeMapStateToProps = () => {
 
 const mapDispatchToProps = (dispatch, { type, id }) => ({
 
-  @debounce(300, true)
-  onScrollToBottom () {
+  onScrollToBottom: debounce(() => {
     dispatch(scrollTopTimeline(type, false));
     dispatch(expandTimeline(type, id));
-  },
+  }, 300, {leading: true}),
 
-  @debounce(100)
-  onScrollToTop () {
+  onScrollToTop: debounce(() => {
     dispatch(scrollTopTimeline(type, true));
-  },
+  }, 100),
 
-  @debounce(100)
-  onScroll () {
+  onScroll: debounce(() => {
     dispatch(scrollTopTimeline(type, false));
-  }
+  }, 100)
 
 });
 
diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js
index d096cb882..4025454f0 100644
--- a/app/javascript/mastodon/features/ui/index.js
+++ b/app/javascript/mastodon/features/ui/index.js
@@ -10,7 +10,7 @@ import ModalContainer from './containers/modal_container';
 import Notifications from '../notifications';
 import { connect } from 'react-redux';
 import { isMobile } from '../../is_mobile';
-import { debounce } from 'react-decoration';
+import { debounce } from 'lodash';
 import { uploadCompose } from '../../actions/compose';
 import { refreshTimeline } from '../../actions/timelines';
 import { refreshNotifications } from '../../actions/notifications';
@@ -26,7 +26,7 @@ class UI extends React.PureComponent {
       width: window.innerWidth,
       draggingOver: false
     };
-    this.handleResize = this.handleResize.bind(this);
+    this.handleResize = debounce(this.handleResize.bind(this), 500);
     this.handleDragEnter = this.handleDragEnter.bind(this);
     this.handleDragOver = this.handleDragOver.bind(this);
     this.handleDrop = this.handleDrop.bind(this);
@@ -36,7 +36,6 @@ class UI extends React.PureComponent {
     this.setRef = this.setRef.bind(this);
   }
 
-  @debounce(500)
   handleResize () {
     this.setState({ width: window.innerWidth });
   }