Fix setting outdated global after async calls (#2165)

This commit is contained in:
Alexander Zinchuk 2022-11-29 17:56:38 +01:00
parent 78b29f2ec4
commit fcbc91326f
2 changed files with 2 additions and 0 deletions

View File

@ -1285,6 +1285,7 @@ addActionHandler('setForwardChatId', async (global, actions, payload) => {
if (!user.fullInfo) {
const { accessHash } = user;
user = await callApi('fetchFullUser', { id, accessHash });
global = getGlobal();
}
if (user?.fullInfo!.noVoiceMessages) {

View File

@ -129,6 +129,7 @@ async function loadAndReplaceMessages() {
const { originChannelId } = threadInfo;
const currentMessageListInfoOrigin = global.messages.byChatId[originChannelId];
const resultOrigin = await loadTopMessages(global.chats.byId[originChannelId]);
global = getGlobal();
if (resultOrigin) {
const byIdOrigin = buildCollectionByKey(resultOrigin.messages, 'id');
const listedIdsOrigin = Object.keys(byIdOrigin).map(Number);