diff options
author | David Yip <yipdw@member.fsf.org> | 2018-01-09 17:01:23 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-09 17:01:23 -0600 |
commit | 622c8fdb75f20f1aee73b5db6d2dc90416bb3b08 (patch) | |
tree | 940b08c3ccbc5901877d0afdb086f42055e5703e /app/javascript/flavours/glitch/features/favourited_statuses | |
parent | 991371af5f22ba85199f3f66bab5f70b404de95f (diff) | |
parent | aef4b1af666f3fe66778bff0bab83b780fc71732 (diff) |
Merge pull request #314 from chriswmartin/merge-vanilla-updates-2
Merge vanilla updates into glitch - round 2
Diffstat (limited to 'app/javascript/flavours/glitch/features/favourited_statuses')
-rw-r--r-- | app/javascript/flavours/glitch/features/favourited_statuses/index.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/favourited_statuses/index.js b/app/javascript/flavours/glitch/features/favourited_statuses/index.js index e20dda718..301a5ae4f 100644 --- a/app/javascript/flavours/glitch/features/favourited_statuses/index.js +++ b/app/javascript/flavours/glitch/features/favourited_statuses/index.js @@ -9,6 +9,7 @@ import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/col import StatusList from 'flavours/glitch/components/status_list'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import { debounce } from 'lodash'; const messages = defineMessages({ heading: { id: 'column.favourites', defaultMessage: 'Favourites' }, @@ -16,6 +17,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ statusIds: state.getIn(['status_lists', 'favourites', 'items']), + isLoading: state.getIn(['status_lists', 'favourites', 'isLoading'], true), hasMore: !!state.getIn(['status_lists', 'favourites', 'next']), }); @@ -30,6 +32,7 @@ export default class Favourites extends ImmutablePureComponent { columnId: PropTypes.string, multiColumn: PropTypes.bool, hasMore: PropTypes.bool, + isLoading: PropTypes.bool, }; componentWillMount () { @@ -59,12 +62,12 @@ export default class Favourites extends ImmutablePureComponent { this.column = c; } - handleScrollToBottom = () => { + handleScrollToBottom = debounce(() => { this.props.dispatch(expandFavouritedStatuses()); - } + }, 300, { leading: true }) render () { - const { intl, statusIds, columnId, multiColumn, hasMore } = this.props; + const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props; const pinned = !!columnId; return ( @@ -85,6 +88,7 @@ export default class Favourites extends ImmutablePureComponent { statusIds={statusIds} scrollKey={`favourited_statuses-${columnId}`} hasMore={hasMore} + isLoading={isLoading} onScrollToBottom={this.handleScrollToBottom} /> </Column> |