Timeline: Use messageChangeCounter to mark messages read less often
This commit is contained in:
parent
69d0ed3309
commit
af2c884c9f
5 changed files with 162 additions and 6 deletions
|
@ -244,6 +244,7 @@ export type MessageLookupType = {
|
|||
};
|
||||
export type ConversationMessageType = {
|
||||
isNearBottom?: boolean;
|
||||
messageChangeCounter: number;
|
||||
messageIds: Array<string>;
|
||||
messageLoadingState?: undefined | TimelineMessageLoadingState;
|
||||
metrics: MessageMetricsType;
|
||||
|
@ -2502,8 +2503,18 @@ export function reducer(
|
|||
return state;
|
||||
}
|
||||
|
||||
const toIncrement = data.reactions?.length ? 1 : 0;
|
||||
|
||||
return {
|
||||
...state,
|
||||
messagesByConversation: {
|
||||
...state.messagesByConversation,
|
||||
[conversationId]: {
|
||||
...existingConversation,
|
||||
messageChangeCounter:
|
||||
(existingConversation.messageChangeCounter || 0) + toIncrement,
|
||||
},
|
||||
},
|
||||
messagesLookup: {
|
||||
...state.messagesLookup,
|
||||
[id]: {
|
||||
|
@ -2582,6 +2593,7 @@ export function reducer(
|
|||
messagesByConversation: {
|
||||
...messagesByConversation,
|
||||
[conversationId]: {
|
||||
messageChangeCounter: 0,
|
||||
scrollToMessageId,
|
||||
scrollToMessageCounter: existingConversation
|
||||
? existingConversation.scrollToMessageCounter + 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue