Ensure that message heights are always recomputed
This commit is contained in:
parent
77924918df
commit
518ebc315e
3 changed files with 15 additions and 5 deletions
|
@ -81,6 +81,7 @@ export type PropsDataType = {
|
||||||
isNearBottom?: boolean;
|
isNearBottom?: boolean;
|
||||||
items: ReadonlyArray<string>;
|
items: ReadonlyArray<string>;
|
||||||
loadCountdownStart?: number;
|
loadCountdownStart?: number;
|
||||||
|
messageHeightChangeBaton?: unknown;
|
||||||
messageHeightChangeIndex?: number;
|
messageHeightChangeIndex?: number;
|
||||||
oldestUnreadIndex?: number;
|
oldestUnreadIndex?: number;
|
||||||
resetCounter: number;
|
resetCounter: number;
|
||||||
|
@ -132,7 +133,7 @@ export type PropsActionsType = {
|
||||||
acknowledgeGroupMemberNameCollisions: (
|
acknowledgeGroupMemberNameCollisions: (
|
||||||
groupNameCollisions: Readonly<GroupNameCollisionsWithIdsByTitle>
|
groupNameCollisions: Readonly<GroupNameCollisionsWithIdsByTitle>
|
||||||
) => void;
|
) => void;
|
||||||
clearChangedMessages: (conversationId: string) => unknown;
|
clearChangedMessages: (conversationId: string, baton: unknown) => unknown;
|
||||||
clearInvitedUuidsForNewlyCreatedGroup: () => void;
|
clearInvitedUuidsForNewlyCreatedGroup: () => void;
|
||||||
closeContactSpoofingReview: () => void;
|
closeContactSpoofingReview: () => void;
|
||||||
setLoadCountdownStart: (
|
setLoadCountdownStart: (
|
||||||
|
@ -1031,6 +1032,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
||||||
isIncomingMessageRequest,
|
isIncomingMessageRequest,
|
||||||
items,
|
items,
|
||||||
messageHeightChangeIndex,
|
messageHeightChangeIndex,
|
||||||
|
messageHeightChangeBaton,
|
||||||
oldestUnreadIndex,
|
oldestUnreadIndex,
|
||||||
resetCounter,
|
resetCounter,
|
||||||
scrollToIndex,
|
scrollToIndex,
|
||||||
|
@ -1088,7 +1090,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
||||||
|
|
||||||
if (isNumber(messageHeightChangeIndex)) {
|
if (isNumber(messageHeightChangeIndex)) {
|
||||||
resizeStartRow = this.fromItemIndexToRow(messageHeightChangeIndex);
|
resizeStartRow = this.fromItemIndexToRow(messageHeightChangeIndex);
|
||||||
clearChangedMessages(id);
|
clearChangedMessages(id, messageHeightChangeBaton);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -622,6 +622,7 @@ export type ClearChangedMessagesActionType = {
|
||||||
type: 'CLEAR_CHANGED_MESSAGES';
|
type: 'CLEAR_CHANGED_MESSAGES';
|
||||||
payload: {
|
payload: {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
baton: unknown;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export type ClearSelectedMessageActionType = {
|
export type ClearSelectedMessageActionType = {
|
||||||
|
@ -1691,12 +1692,14 @@ function setRecentMediaItems(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function clearChangedMessages(
|
function clearChangedMessages(
|
||||||
conversationId: string
|
conversationId: string,
|
||||||
|
baton: unknown
|
||||||
): ClearChangedMessagesActionType {
|
): ClearChangedMessagesActionType {
|
||||||
return {
|
return {
|
||||||
type: 'CLEAR_CHANGED_MESSAGES',
|
type: 'CLEAR_CHANGED_MESSAGES',
|
||||||
payload: {
|
payload: {
|
||||||
conversationId,
|
conversationId,
|
||||||
|
baton,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3048,10 +3051,14 @@ export function reducer(
|
||||||
}
|
}
|
||||||
if (action.type === 'CLEAR_CHANGED_MESSAGES') {
|
if (action.type === 'CLEAR_CHANGED_MESSAGES') {
|
||||||
const { payload } = action;
|
const { payload } = action;
|
||||||
const { conversationId } = payload;
|
const { conversationId, baton } = payload;
|
||||||
const existingConversation = state.messagesByConversation[conversationId];
|
const existingConversation = state.messagesByConversation[conversationId];
|
||||||
|
|
||||||
if (!existingConversation) {
|
if (
|
||||||
|
!existingConversation ||
|
||||||
|
existingConversation.heightChangeMessageIds !== baton
|
||||||
|
) {
|
||||||
|
log.warn('CLEAR_CHANGED_MESSAGES used expired baton');
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -888,6 +888,7 @@ export function _conversationMessagesSelector(
|
||||||
loadCountdownStart,
|
loadCountdownStart,
|
||||||
items,
|
items,
|
||||||
isNearBottom,
|
isNearBottom,
|
||||||
|
messageHeightChangeBaton: heightChangeMessageIds,
|
||||||
messageHeightChangeIndex:
|
messageHeightChangeIndex:
|
||||||
isNumber(messageHeightChangeIndex) && messageHeightChangeIndex >= 0
|
isNumber(messageHeightChangeIndex) && messageHeightChangeIndex >= 0
|
||||||
? messageHeightChangeIndex
|
? messageHeightChangeIndex
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue