Fix home timeline perpetually reloading when empty (#10130)

Regression from #6876
This commit is contained in:
Eugen Rochko 2019-03-01 11:11:35 +01:00 committed by GitHub
parent 5ecbf4d4c0
commit 3e0ed36e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({ const mapStateToProps = state => ({
hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0, hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0,
isPartial: state.getIn(['timelines', 'home', 'items', 0], null) === null, isPartial: state.getIn(['timelines', 'home', 'isPartial']),
}); });
export default @connect(mapStateToProps) export default @connect(mapStateToProps)

View File

@ -29,6 +29,8 @@ const initialTimeline = ImmutableMap({
const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, isLoadingRecent) => { const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, isLoadingRecent) => {
return state.update(timeline, initialTimeline, map => map.withMutations(mMap => { return state.update(timeline, initialTimeline, map => map.withMutations(mMap => {
mMap.set('isLoading', false); mMap.set('isLoading', false);
mMap.set('isPartial', isPartial);
if (!next && !isLoadingRecent) mMap.set('hasMore', false); if (!next && !isLoadingRecent) mMap.set('hasMore', false);
if (!statuses.isEmpty()) { if (!statuses.isEmpty()) {