diff --git a/app/soapbox/features/ui/containers/status_list_container.js b/app/soapbox/features/ui/containers/status_list_container.js index 41c345df3..5760a4f69 100644 --- a/app/soapbox/features/ui/containers/status_list_container.js +++ b/app/soapbox/features/ui/containers/status_list_container.js @@ -21,18 +21,23 @@ const makeGetStatusIds = () => createSelector([ }); }); -const mapStateToProps = (state, { timelineId }) => { - const lastStatusId = state.getIn(['timelines', timelineId, 'items'], ImmutableList()).last(); +const makeMapStateToProps = () => { const getStatusIds = makeGetStatusIds(); - 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']), - totalQueuedItemsCount: state.getIn(['timelines', timelineId, 'totalQueuedItemsCount']), + const mapStateToProps = (state, { timelineId }) => { + const lastStatusId = state.getIn(['timelines', timelineId, 'items'], ImmutableList()).last(); + + 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']), + totalQueuedItemsCount: state.getIn(['timelines', timelineId, 'totalQueuedItemsCount']), + }; }; + + return mapStateToProps; }; const mapDispatchToProps = (dispatch, ownProps) => ({ @@ -47,4 +52,4 @@ const mapDispatchToProps = (dispatch, ownProps) => ({ }, 100), }); -export default connect(mapStateToProps, mapDispatchToProps)(StatusList); +export default connect(makeMapStateToProps, mapDispatchToProps)(StatusList);