Message List: Fix stuck scheduled loading (#6846)

This commit is contained in:
zubiden 2026-04-14 14:36:39 +02:00 committed by Alexander Zinchuk
parent 8f5108cac0
commit 32a0a1e9cd
2 changed files with 5 additions and 4 deletions

View File

@ -921,22 +921,24 @@ export default memo(withGlobal<OwnProps>(
}
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<StateProps>;
}
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 = (

View File

@ -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);