Fix StatusList memoization

actually-fix-tabs-bar
Alex Gleason 2021-07-01 19:41:16 -05:00
rodzic 8961fc1b68
commit 352c87c3b7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 15 dodań i 10 usunięć

Wyświetl plik

@ -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);