Guard against composer setting quote while conversation switched

This commit is contained in:
Josh Perez 2023-01-03 17:32:40 -05:00 committed by GitHub
parent 3c80272673
commit add184d0da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -258,6 +258,10 @@ function scrollToQuotedMessage({
return; return;
} }
if (getState().conversations.selectedConversationId !== conversationId) {
return;
}
scrollToMessage(conversationId, message.id)(dispatch, getState, undefined); scrollToMessage(conversationId, message.id)(dispatch, getState, undefined);
}; };
} }
@ -529,6 +533,12 @@ export function setQuoteByMessageId(
if (message) { if (message) {
const quote = await conversation.makeQuote(message); const quote = await conversation.makeQuote(message);
// In case the conversation changed while we were about to set the quote
if (getState().conversations.selectedConversationId !== conversationId) {
return;
}
dispatch( dispatch(
setQuotedMessage({ setQuotedMessage({
conversationId, conversationId,