Chats: fix flickering during update

loading-indicator-on-tls^2
Alex Gleason 2020-08-27 00:24:11 -05:00
rodzic 9af664bda8
commit 8b621d30fc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -55,7 +55,7 @@ export function connectTimelineStream(timelineId, path, pollingRefresh = null, a
dispatch(fetchFilters());
break;
case 'pleroma:chat_update':
dispatch({ type: STREAMING_CHAT_UPDATE, chat: JSON.parse(data.payload) });
dispatch({ type: STREAMING_CHAT_UPDATE, chat: JSON.parse(data.payload), me: getState().get('me') });
break;
}
},

Wyświetl plik

@ -38,15 +38,16 @@ export default function chatMessageLists(state = initialState, action) {
case CHATS_FETCH_SUCCESS:
return importLastMessages(state, action.chats).sort();
case STREAMING_CHAT_UPDATE:
if (action.chat.last_message)
if (action.chat.last_message &&
action.chat.last_message.account_id !== action.me)
return importMessages(state, [action.chat.last_message]).sort();
else
return state.sort();
return state;
case CHAT_MESSAGES_FETCH_SUCCESS:
return updateList(state, action.chatId, action.chatMessages.map(chat => chat.id).reverse()).sort();
case CHAT_MESSAGE_SEND_SUCCESS:
return updateList(state, action.chatId, [action.chatMessage.id]).sort();
default:
return state.sort();
return state;
}
};