From e45f7a3bb196eb28b691735ff8ca35fc6fa31f61 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Tue, 18 Jun 2024 15:41:35 +0200 Subject: [PATCH] Avoid having 2 gaps at the top of the notifications after a disconnect --- app/javascript/mastodon/reducers/notifications_groups.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/notifications_groups.ts b/app/javascript/mastodon/reducers/notifications_groups.ts index c332525421..5d2eeceac1 100644 --- a/app/javascript/mastodon/reducers/notifications_groups.ts +++ b/app/javascript/mastodon/reducers/notifications_groups.ts @@ -161,11 +161,15 @@ export const notificationsGroupsReducer = } }) .addCase(disconnectTimeline, (state, action) => { - if (action.payload.timeline === 'home') + if (action.payload.timeline === 'home') { + if (state.groups.length > 0 && state.groups[0]?.type === 'gap') + state.groups.shift(); + state.groups.unshift({ type: 'gap', loadUrl: 'TODO_LOAD_URL_TOP_OF_TL', // TODO }); + } }) .addCase(timelineDelete, (state, action) => { removeNotificationsForStatus(state, action.payload.statusId);