diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index 7fb49ae6c..36718b3bb 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -921,22 +921,24 @@ export default memo(withGlobal( } const messageIds = selectCurrentMessageIds(global, chatId, threadId, type); + const chatMessagesById = selectChatMessages(global, chatId); const messagesById = type === 'scheduled' ? selectChatScheduledMessages(global, chatId) - : selectChatMessages(global, chatId); + : chatMessagesById; const isSavedDialog = getIsSavedDialog(chatId, threadId, currentUserId); if ( threadId !== MAIN_THREAD_ID && !isSavedDialog && !chat?.isForum - && !(messagesById && threadId && messagesById[Number(threadId)]) + && !(chatMessagesById && threadId && chatMessagesById[Number(threadId)]) ) { return { currentUserId } as Complete; } const isRestricted = selectIsChatRestricted(global, chatId); const restrictionReasons = selectActiveRestrictionReasons(global, chat?.restrictionReasons); - const lastMessage = selectChatLastMessage(global, chatId, isSavedDialog ? 'saved' : 'all'); + const lastMessage = type === 'thread' ? selectChatLastMessage(global, chatId, isSavedDialog ? 'saved' : 'all') + : undefined; const focusingId = selectFocusedMessageId(global, chatId); const withLastMessageWhenPreloading = ( diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index 844a61710..ae2462997 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -1538,7 +1538,6 @@ addActionHandler('loadScheduledHistory', async (global, actions, payload): Promi Object.entries(idsByThreadId).forEach(([tId, newThreadScheduledIds]) => { const threadId = tId as ThreadId; - if (!chat.isForum && threadId !== MAIN_THREAD_ID) return; global = replaceThreadLocalStateParam(global, chat.id, threadId, 'scheduledIds', newThreadScheduledIds); }); setGlobal(global);