* 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
This commit is contained in:
@ -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),
|
||||
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ import { connect } from 'react-redux';
|
||||
import { isMobile } from '../../is_mobile';
|
||||
import { debounce } from 'lodash';
|
||||
import { uploadCompose } from '../../actions/compose';
|
||||
import { refreshTimeline } from '../../actions/timelines';
|
||||
import { refreshHomeTimeline } from '../../actions/timelines';
|
||||
import { refreshNotifications } from '../../actions/notifications';
|
||||
import UploadArea from './components/upload_area';
|
||||
import ColumnsAreaContainer from './containers/columns_area_container';
|
||||
@ -95,7 +95,7 @@ class UI extends React.PureComponent {
|
||||
document.addEventListener('dragleave', this.handleDragLeave, false);
|
||||
document.addEventListener('dragend', this.handleDragEnd, false);
|
||||
|
||||
this.props.dispatch(refreshTimeline('home'));
|
||||
this.props.dispatch(refreshHomeTimeline());
|
||||
this.props.dispatch(refreshNotifications());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user