Fix setting outdated global after async calls (#2165)
This commit is contained in:
parent
78b29f2ec4
commit
fcbc91326f
@ -1285,6 +1285,7 @@ addActionHandler('setForwardChatId', async (global, actions, payload) => {
|
|||||||
if (!user.fullInfo) {
|
if (!user.fullInfo) {
|
||||||
const { accessHash } = user;
|
const { accessHash } = user;
|
||||||
user = await callApi('fetchFullUser', { id, accessHash });
|
user = await callApi('fetchFullUser', { id, accessHash });
|
||||||
|
global = getGlobal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user?.fullInfo!.noVoiceMessages) {
|
if (user?.fullInfo!.noVoiceMessages) {
|
||||||
|
|||||||
@ -129,6 +129,7 @@ async function loadAndReplaceMessages() {
|
|||||||
const { originChannelId } = threadInfo;
|
const { originChannelId } = threadInfo;
|
||||||
const currentMessageListInfoOrigin = global.messages.byChatId[originChannelId];
|
const currentMessageListInfoOrigin = global.messages.byChatId[originChannelId];
|
||||||
const resultOrigin = await loadTopMessages(global.chats.byId[originChannelId]);
|
const resultOrigin = await loadTopMessages(global.chats.byId[originChannelId]);
|
||||||
|
global = getGlobal();
|
||||||
if (resultOrigin) {
|
if (resultOrigin) {
|
||||||
const byIdOrigin = buildCollectionByKey(resultOrigin.messages, 'id');
|
const byIdOrigin = buildCollectionByKey(resultOrigin.messages, 'id');
|
||||||
const listedIdsOrigin = Object.keys(byIdOrigin).map(Number);
|
const listedIdsOrigin = Object.keys(byIdOrigin).map(Number);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user