Avoid having 2 gaps at the top of the notifications after a disconnect

Renaud Chaput 2024-06-18 15:41:35 +02:00 committed by Claire
parent 4e5768ed5e
commit 5db3135704
1 changed files with 5 additions and 1 deletions

View File

@ -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);