mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Fix cache invalidation for conversation preload
This commit is contained in:
@@ -5635,7 +5635,7 @@ export function reducer(
|
||||
if (action.type === MESSAGE_EXPIRED) {
|
||||
return maybeUpdateSelectedMessageForDetails(
|
||||
{ messageId: action.payload.id, targetedMessageForDetails: undefined },
|
||||
state
|
||||
dropPreloadData(state)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5949,20 +5949,21 @@ export function reducer(
|
||||
if (action.type === 'MESSAGES_ADDED') {
|
||||
const { conversationId, isActive, isJustSent, isNewMessage, messages } =
|
||||
action.payload;
|
||||
const { messagesByConversation, messagesLookup } = state;
|
||||
|
||||
const existingConversation = messagesByConversation[conversationId];
|
||||
if (!existingConversation) {
|
||||
return state;
|
||||
}
|
||||
|
||||
let { newest, oldest, oldestUnseen, totalUnseen } =
|
||||
existingConversation.metrics;
|
||||
|
||||
if (messages.length < 1) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const { messagesByConversation, messagesLookup } = state;
|
||||
|
||||
const existingConversation = messagesByConversation[conversationId];
|
||||
if (!existingConversation) {
|
||||
return dropPreloadData(state);
|
||||
}
|
||||
|
||||
let { newest, oldest, oldestUnseen, totalUnseen } =
|
||||
existingConversation.metrics;
|
||||
|
||||
const lookup = fromPairs(
|
||||
existingConversation.messageIds.map(id => [id, messagesLookup[id]])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user