From 369b0ac9ce71acb1436afcb21641630ccd3ad974 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 13 Sep 2023 12:21:30 +0200 Subject: [PATCH] App: Fix opening chat by phone number (#3830) --- src/global/actions/api/chats.ts | 3 +-- src/global/actions/apiUpdaters/initial.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/global/actions/api/chats.ts b/src/global/actions/api/chats.ts index f4cf80205..3372dc8c5 100644 --- a/src/global/actions/api/chats.ts +++ b/src/global/actions/api/chats.ts @@ -2496,12 +2496,11 @@ export async function fetchChatByPhoneNumber(global: T, p global = getGlobal(); global = updateChat(global, chat.id, chat); - setGlobal(global); if (user) { global = updateUser(global, user.id, user); - setGlobal(global); } + setGlobal(global); return chat; } diff --git a/src/global/actions/apiUpdaters/initial.ts b/src/global/actions/apiUpdaters/initial.ts index da9bac26e..05802256b 100644 --- a/src/global/actions/apiUpdaters/initial.ts +++ b/src/global/actions/apiUpdaters/initial.ts @@ -227,7 +227,7 @@ function onUpdateConnectionState( .map((messageList) => messageList.chatId) .filter((chatId) => { const chat = global.chats.byId[chatId]; - return isChatChannel(chat) || isChatSuperGroup(chat); + return chat && (isChatChannel(chat) || isChatSuperGroup(chat)); }); if (connectionState === 'connectionStateReady' && channelStackIds.length) { unique(channelStackIds).forEach((chatId) => {