0
0
Fork 0

Fix “slow mode” issues (#11859)

* Fix weird scroll-jumping behavior with pending items

* Treat pending items as unread items

* Fix scroll position being altered because of the “X new items” button
This commit is contained in:
ThibG 2019-09-16 15:45:06 +02:00 committed by Eugen Rochko
parent 5eff29b28c
commit f109867578
5 changed files with 15 additions and 7 deletions

View file

@ -65,7 +65,7 @@ const updateTimeline = (state, timeline, status, usePendingItems) => {
return state;
}
return state.update(timeline, initialTimeline, map => map.update('pendingItems', list => list.unshift(status.get('id'))));
return state.update(timeline, initialTimeline, map => map.update('pendingItems', list => list.unshift(status.get('id'))).update('unread', unread => unread + 1));
}
const top = state.getIn([timeline, 'top']);
@ -128,7 +128,7 @@ const filterTimeline = (timeline, state, relationship, statuses) => {
const updateTop = (state, timeline, top) => {
return state.update(timeline, initialTimeline, map => map.withMutations(mMap => {
if (top) mMap.set('unread', 0);
if (top) mMap.set('unread', mMap.get('pendingItems').size);
mMap.set('top', top);
}));
};