Change timelines to add new items to pending items when scrolled down (#11867)
This commit is contained in:
parent
576377a382
commit
d256901f60
2 changed files with 9 additions and 5 deletions
|
@ -35,12 +35,12 @@ const notificationToMap = notification => ImmutableMap({
|
|||
});
|
||||
|
||||
const normalizeNotification = (state, notification, usePendingItems) => {
|
||||
if (usePendingItems) {
|
||||
const top = state.get('top');
|
||||
|
||||
if (usePendingItems || !top || !state.get('pendingItems').isEmpty()) {
|
||||
return state.update('pendingItems', list => list.unshift(notificationToMap(notification))).update('unread', unread => unread + 1);
|
||||
}
|
||||
|
||||
const top = state.get('top');
|
||||
|
||||
if (!top) {
|
||||
state = state.update('unread', unread => unread + 1);
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ const expandNormalizedNotifications = (state, notifications, next, usePendingIte
|
|||
|
||||
return state.withMutations(mutable => {
|
||||
if (!items.isEmpty()) {
|
||||
usePendingItems = usePendingItems || !mutable.get('top') || !mutable.get('pendingItems').isEmpty();
|
||||
|
||||
mutable.update(usePendingItems ? 'pendingItems' : 'items', list => {
|
||||
const lastIndex = 1 + list.findLastIndex(
|
||||
item => item !== null && (compareId(item.get('id'), items.last().get('id')) > 0 || item.get('id') === items.last().get('id'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue