App: Fix opening chat by phone number (#3830)

This commit is contained in:
Alexander Zinchuk 2023-09-13 12:21:30 +02:00
parent a3aeab9ee8
commit 369b0ac9ce
2 changed files with 2 additions and 3 deletions

View File

@ -2496,12 +2496,11 @@ export async function fetchChatByPhoneNumber<T extends GlobalState>(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;
}

View File

@ -227,7 +227,7 @@ function onUpdateConnectionState<T extends GlobalState>(
.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) => {