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

Renaud Chaput 2024-06-18 15:41:35 +02:00
parent 0f9bfb342c
commit e45f7a3bb1
No known key found for this signature in database
GPG Key ID: BCFC859D49B46990
1 changed files with 5 additions and 1 deletions

View File

@ -161,11 +161,15 @@ export const notificationsGroupsReducer =
} }
}) })
.addCase(disconnectTimeline, (state, action) => { .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({ state.groups.unshift({
type: 'gap', type: 'gap',
loadUrl: 'TODO_LOAD_URL_TOP_OF_TL', // TODO loadUrl: 'TODO_LOAD_URL_TOP_OF_TL', // TODO
}); });
}
}) })
.addCase(timelineDelete, (state, action) => { .addCase(timelineDelete, (state, action) => {
removeNotificationsForStatus(state, action.payload.statusId); removeNotificationsForStatus(state, action.payload.statusId);