From b0ec3bfcf996565a08870a0f2b735f66b7fdf5b5 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 16 May 2023 15:36:25 +0200 Subject: [PATCH] [Glitch] Fix being unable to load past a full page of filtered posts in Home timeline Port 7b54e47d034556a8709425ed8d7fc0a0da34c01a to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/components/status_list.jsx | 4 +++- .../glitch/features/ui/containers/status_list_container.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/components/status_list.jsx b/app/javascript/flavours/glitch/components/status_list.jsx index a9c06f693..a225883a8 100644 --- a/app/javascript/flavours/glitch/components/status_list.jsx +++ b/app/javascript/flavours/glitch/components/status_list.jsx @@ -26,6 +26,7 @@ export default class StatusList extends ImmutablePureComponent { alwaysPrepend: PropTypes.bool, withCounters: PropTypes.bool, timelineId: PropTypes.string.isRequired, + lastId: PropTypes.string, regex: PropTypes.string, }; @@ -56,7 +57,8 @@ export default class StatusList extends ImmutablePureComponent { }; 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 }); _selectChild (index, align_top) { diff --git a/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js b/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js index 3cd0707f2..92ddc01c8 100644 --- a/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js +++ b/app/javascript/flavours/glitch/features/ui/containers/status_list_container.js @@ -60,6 +60,7 @@ const makeMapStateToProps = () => { const mapStateToProps = (state, { timelineId, regex }) => ({ statusIds: getStatusIds(state, { type: timelineId, regex }), + lastId: state.getIn(['timelines', timelineId, 'items'])?.last(), isLoading: state.getIn(['timelines', timelineId, 'isLoading'], true), isPartial: state.getIn(['timelines', timelineId, 'isPartial'], false), hasMore: state.getIn(['timelines', timelineId, 'hasMore']),