pass last statusID into status list before filtering, fixes #340

This commit is contained in:
Mary Kate 2020-08-25 14:48:41 -05:00
parent 22abaafd7a
commit fbee7a237c
2 changed files with 7 additions and 1 deletions

View file

@ -18,6 +18,7 @@ export default class StatusList extends ImmutablePureComponent {
static propTypes = {
scrollKey: PropTypes.string.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
lastStatusId: PropTypes.string,
featuredStatusIds: ImmutablePropTypes.list,
onLoadMore: PropTypes.func,
isLoading: PropTypes.bool,
@ -62,7 +63,8 @@ export default class StatusList extends ImmutablePureComponent {
}
handleLoadOlder = debounce(() => {
this.props.onLoadMore(this.props.statusIds.size > 0 ? this.props.statusIds.last() : undefined);
const loadMoreID = this.props.lastStatusId ? this.props.lastStatusId : this.props.statusIds.last();
this.props.onLoadMore(loadMoreID ? loadMoreID : undefined);
}, 300, { leading: true })
_selectChild(index, align_top) {

View file

@ -8,12 +8,15 @@ import { scrollTopTimeline } from '../../../actions/timelines';
import { getSettings } from 'soapbox/actions/settings';
import { shouldFilter } from 'soapbox/utils/timelines';
let lastStatusId;
const makeGetStatusIds = () => createSelector([
(state, { type }) => getSettings(state).get(type, ImmutableMap()),
(state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()),
(state) => state.get('statuses'),
(state) => state.get('me'),
], (columnSettings, statusIds, statuses, me) => {
lastStatusId = statusIds.last();
return statusIds.filter(id => {
const status = statuses.get(id);
if (!status) return true;
@ -26,6 +29,7 @@ const mapStateToProps = (state, { timelineId }) => {
return {
statusIds: getStatusIds(state, { type: timelineId }),
lastStatusId: lastStatusId,
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
hasMore: state.getIn(['timelines', timelineId, 'hasMore']),