Skip to content

Commit 69dd0ee

Browse files
Gargronhiyuki2578
authored andcommitted
Revert "Change timelines to add new items to pending items when scrolled down mastodon#11867" (mastodon#11921)
Fix mastodon#11912
1 parent 9fa55f1 commit 69dd0ee

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

app/javascript/mastodon/reducers/notifications.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ const notificationToMap = notification => ImmutableMap({
3838
});
3939

4040
const normalizeNotification = (state, notification, usePendingItems) => {
41-
const top = state.get('top');
42-
const mounted = state.get('mounted');
41+
const top = state.get('top');
4342

44-
if (usePendingItems || (!top && mounted) || !state.get('pendingItems').isEmpty()) {
43+
if (usePendingItems || !state.get('pendingItems').isEmpty()) {
4544
return state.update('pendingItems', list => list.unshift(notificationToMap(notification))).update('unread', unread => unread + 1);
4645
}
4746

@@ -67,7 +66,7 @@ const expandNormalizedNotifications = (state, notifications, next, isLoadingRece
6766

6867
return state.withMutations(mutable => {
6968
if (!items.isEmpty()) {
70-
usePendingItems = isLoadingRecent && (usePendingItems || (!mutable.get('top') && mutable.get('mounted')) || !mutable.get('pendingItems').isEmpty());
69+
usePendingItems = isLoadingRecent && (usePendingItems || !mutable.get('pendingItems').isEmpty());
7170

7271
mutable.update(usePendingItems ? 'pendingItems' : 'items', list => {
7372
const lastIndex = 1 + list.findLastIndex(

app/javascript/mastodon/reducers/timelines.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
4040
if (timeline.endsWith(':pinned')) {
4141
mMap.set('items', statuses.map(status => status.get('id')));
4242
} else if (!statuses.isEmpty()) {
43-
usePendingItems = isLoadingRecent && (usePendingItems || !mMap.get('top') || !mMap.get('pendingItems').isEmpty());
43+
usePendingItems = isLoadingRecent && (usePendingItems || !mMap.get('pendingItems').isEmpty());
44+
4445
mMap.update(usePendingItems ? 'pendingItems' : 'items', ImmutableList(), oldIds => {
4546
const newIds = statuses.map(status => status.get('id'));
4647

@@ -63,7 +64,7 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
6364
const updateTimeline = (state, timeline, status, usePendingItems) => {
6465
const top = state.getIn([timeline, 'top']);
6566

66-
if (usePendingItems || !top || !state.getIn([timeline, 'pendingItems']).isEmpty()) {
67+
if (usePendingItems || !state.getIn([timeline, 'pendingItems']).isEmpty()) {
6768
if (state.getIn([timeline, 'pendingItems'], ImmutableList()).includes(status.get('id')) || state.getIn([timeline, 'items'], ImmutableList()).includes(status.get('id'))) {
6869
return state;
6970
}

0 commit comments

Comments
 (0)