diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-11 17:07:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-11 17:07:35 +0200 |
commit | 47bf7a8047ce59b899d147e4483168f9852eeb7c (patch) | |
tree | 79dd51ed84b1ed350cd754c8fca988dd6718a93a /app/javascript/mastodon/features/ui/containers/status_list_container.js | |
parent | 85d405c810a3bfc146c7901d770444419f32e46f (diff) |
Fix #3665 - Refactor timelines reducer (#3686)
* Move ancestors/descendants out of timelines reducer * Refactor timelines reducer All types of timelines now have a flat structure and use the same reducer functions and actions * Reintroduce some missing behaviours * Fix wrong import in reports * Fix includes typo * Fix issue related to "next" pagination in timelines and notifications * Fix bug with timeline's initial state, expandNotifications
Diffstat (limited to 'app/javascript/mastodon/features/ui/containers/status_list_container.js')
-rw-r--r-- | app/javascript/mastodon/features/ui/containers/status_list_container.js | 24 |
1 files changed, 11 insertions, 13 deletions
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 cbdd2d12d..8d8dc9ba9 100644 --- a/app/javascript/mastodon/features/ui/containers/status_list_container.js +++ b/app/javascript/mastodon/features/ui/containers/status_list_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import StatusList from '../../../components/status_list'; -import { expandTimeline, scrollTopTimeline } from '../../../actions/timelines'; +import { scrollTopTimeline } from '../../../actions/timelines'; import Immutable from 'immutable'; import { createSelector } from 'reselect'; import { debounce } from 'lodash'; @@ -39,31 +39,29 @@ const makeGetStatusIds = () => createSelector([ const makeMapStateToProps = () => { const getStatusIds = makeGetStatusIds(); - const mapStateToProps = (state, props) => ({ - scrollKey: props.scrollKey, - shouldUpdateScroll: props.shouldUpdateScroll, - statusIds: getStatusIds(state, props), - isLoading: state.getIn(['timelines', props.type, 'isLoading'], true), - isUnread: state.getIn(['timelines', props.type, 'unread']) > 0, - hasMore: !!state.getIn(['timelines', props.type, 'next']), + const mapStateToProps = (state, { timelineId }) => ({ + statusIds: getStatusIds(state, { type: timelineId }), + isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true), + isUnread: state.getIn(['timelines', timelineId, 'unread']) > 0, + hasMore: !!state.getIn(['timelines', timelineId, 'next']), }); return mapStateToProps; }; -const mapDispatchToProps = (dispatch, { type, id }) => ({ +const mapDispatchToProps = (dispatch, { timelineId, loadMore }) => ({ onScrollToBottom: debounce(() => { - dispatch(scrollTopTimeline(type, false)); - dispatch(expandTimeline(type, id)); + dispatch(scrollTopTimeline(timelineId, false)); + loadMore(); }, 300, { leading: true }), onScrollToTop: debounce(() => { - dispatch(scrollTopTimeline(type, true)); + dispatch(scrollTopTimeline(timelineId, true)); }, 100), onScroll: debounce(() => { - dispatch(scrollTopTimeline(type, false)); + dispatch(scrollTopTimeline(timelineId, false)); }, 100), }); |