Message: Prevent desync when deleting while sending (#5516)
This commit is contained in:
parent
88f14ab310
commit
b8ec2f69d4
@ -410,6 +410,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
...currentMessage,
|
...currentMessage,
|
||||||
...message,
|
...message,
|
||||||
previousLocalId: localId,
|
previousLocalId: localId,
|
||||||
|
isDeleting: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (poll) {
|
if (poll) {
|
||||||
@ -487,6 +488,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
...currentMessage,
|
...currentMessage,
|
||||||
...message,
|
...message,
|
||||||
previousLocalId: localId,
|
previousLocalId: localId,
|
||||||
|
isDeleting: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (poll) {
|
if (poll) {
|
||||||
@ -1177,7 +1179,9 @@ export function deleteMessages<T extends GlobalState>(
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
global = getGlobal();
|
global = getGlobal();
|
||||||
global = deleteChatMessages(global, chatId, ids);
|
// Prevent local deletion of sent messages in case of desync
|
||||||
|
const stillDeletedIds = ids.filter((id) => selectChatMessage(global, chatId, id)?.isDeleting);
|
||||||
|
global = deleteChatMessages(global, chatId, stillDeletedIds);
|
||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
}, isAnimatingAsSnap ? SNAP_ANIMATION_DELAY : ANIMATION_DELAY);
|
}, isAnimatingAsSnap ? SNAP_ANIMATION_DELAY : ANIMATION_DELAY);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user