From 356c8cd4974080d3ce89390873349579e2ca90af Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sun, 19 Mar 2023 22:33:53 -0500 Subject: [PATCH] Scheduled Messages: Fix render errors (#2851) --- src/components/middle/MessageList.tsx | 6 ++++-- src/components/middle/composer/AttachmentModal.tsx | 2 +- src/components/middle/composer/Composer.tsx | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index 58ab45707..b1534e19e 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -248,10 +248,12 @@ const MessageList: FC = ({ } const listedMessages = viewportIds.map((id) => messagesById[id]).filter(Boolean); + + const orderRule: (keyof ApiMessage)[] = type === 'scheduled' ? ['date', 'id'] : ['id']; return listedMessages.length - ? groupMessages(orderBy(listedMessages, 'id'), memoUnreadDividerBeforeIdRef.current) + ? groupMessages(orderBy(listedMessages, orderRule), memoUnreadDividerBeforeIdRef.current) : undefined; - }, [messageIds, messagesById, threadFirstMessageId, threadTopMessageId]); + }, [messageIds, messagesById, threadFirstMessageId, threadTopMessageId, type]); useInterval(() => { if (!messageIds || !messagesById) { diff --git a/src/components/middle/composer/AttachmentModal.tsx b/src/components/middle/composer/AttachmentModal.tsx index b08a464f0..656c4db27 100644 --- a/src/components/middle/composer/AttachmentModal.tsx +++ b/src/components/middle/composer/AttachmentModal.tsx @@ -581,7 +581,7 @@ const AttachmentModal: FC = ({ onClick={handleSendClick} onContextMenu={canShowCustomSendMenu ? handleContextMenu : undefined} > - {lang('Send')} + {shouldSchedule ? lang('Next') : lang('Send')} {canShowCustomSendMenu && ( = ({ shouldForceCompression={shouldForceCompression} shouldForceAsFile={shouldForceAsFile} isForCurrentMessageList={isForCurrentMessageList} + shouldSchedule={shouldSchedule} onCaptionUpdate={onCaptionUpdate} onSendSilent={handleSendSilentAttachments} onSend={handleSendAttachments}