From 5bc0183e71f2033691007a7ead3c5db53e78d152 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 6 Dec 2024 19:44:23 +0400 Subject: [PATCH] Chat With Bot: Fix composer flick on opening (#5278) --- src/global/selectors/chats.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/global/selectors/chats.ts b/src/global/selectors/chats.ts index 4846e6f4b..a06513eeb 100644 --- a/src/global/selectors/chats.ts +++ b/src/global/selectors/chats.ts @@ -2,7 +2,6 @@ import type { ApiChat, ApiChatFullInfo, ApiChatType, } from '../../api/types'; import type { ChatListType, GlobalState, TabArgs } from '../types'; -import { MAIN_THREAD_ID } from '../../api/types'; import { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID, MEMBERS_LOAD_SLICE, SAVED_FOLDER_ID, SERVICE_NOTIFICATIONS_USER_ID, @@ -114,9 +113,8 @@ export function selectChatType(global: T, chatId: string) } export function selectIsChatBotNotStarted(global: T, chatId: string) { - const chat = selectChat(global, chatId); const bot = selectBot(global, chatId); - if (!chat || !bot) { + if (!bot) { return false; } @@ -125,13 +123,7 @@ export function selectIsChatBotNotStarted(global: T, chat return true; } - const messageInfo = global.messages.byChatId[chatId]; - if (!messageInfo) { - return false; - } - - const { listedIds } = messageInfo.threadsById[MAIN_THREAD_ID] || {}; - return listedIds && !listedIds.length; + return Boolean(!lastMessage); } export function selectAreActiveChatsLoaded(global: T): boolean {