[Glitch] Fix being unable to load past a full page of filtered posts in Home timeline

Port 7b54e47d03 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire 2023-05-16 15:36:25 +02:00
parent 4a1f4cb6a2
commit b0ec3bfcf9
2 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ export default class StatusList extends ImmutablePureComponent {
alwaysPrepend: PropTypes.bool, alwaysPrepend: PropTypes.bool,
withCounters: PropTypes.bool, withCounters: PropTypes.bool,
timelineId: PropTypes.string.isRequired, timelineId: PropTypes.string.isRequired,
lastId: PropTypes.string,
regex: PropTypes.string, regex: PropTypes.string,
}; };
@ -56,7 +57,8 @@ export default class StatusList extends ImmutablePureComponent {
}; };
handleLoadOlder = debounce(() => { handleLoadOlder = debounce(() => {
this.props.onLoadMore(this.props.statusIds.size > 0 ? this.props.statusIds.last() : undefined); const { statusIds, lastId, onLoadMore } = this.props;
onLoadMore(lastId || (statusIds.size > 0 ? statusIds.last() : undefined));
}, 300, { leading: true }); }, 300, { leading: true });
_selectChild (index, align_top) { _selectChild (index, align_top) {

View File

@ -60,6 +60,7 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { timelineId, regex }) => ({ const mapStateToProps = (state, { timelineId, regex }) => ({
statusIds: getStatusIds(state, { type: timelineId, regex }), statusIds: getStatusIds(state, { type: timelineId, regex }),
lastId: state.getIn(['timelines', timelineId, 'items'])?.last(),
isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true), isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true),
isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false), isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false),
hasMore: state.getIn(['timelines', timelineId, 'hasMore']), hasMore: state.getIn(['timelines', timelineId, 'hasMore']),