From 3a0bec4a554874f8f05e44165b0d5dea999aaa90 Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Mon, 20 Jul 2026 11:58:40 +0200 Subject: [PATCH] fix: remove replies usage entirely --- .../Threads/ThreadList/ThreadListItemUI.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/Threads/ThreadList/ThreadListItemUI.tsx b/src/components/Threads/ThreadList/ThreadListItemUI.tsx index 1cea2622f..386d02237 100644 --- a/src/components/Threads/ThreadList/ThreadListItemUI.tsx +++ b/src/components/Threads/ThreadList/ThreadListItemUI.tsx @@ -32,7 +32,6 @@ export const ThreadListItemUI = ({ (nextValue: ThreadState) => ({ channel: nextValue.channel, deletedAt: nextValue.deletedAt, - latestReply: nextValue.replies.at(-1), ownUnreadMessageCount: (client.userID && nextValue.read[client.userID]?.unreadMessageCount) || 0, parentMessage: nextValue.parentMessage, @@ -45,13 +44,22 @@ export const ThreadListItemUI = ({ const { channel, deletedAt, - latestReply, ownUnreadMessageCount, parentMessage, participants, replyCount, } = useStateStore(thread.state, selector); + // The latest-reply preview comes from the messagePaginator, the sole reply source. + const latestReplySelector = useMemo( + () => () => ({ + latestReply: thread.messagePaginator.state.getLatestValue().items?.at(-1), + }), + [thread.messagePaginator], + ); + const { latestReply } = + useStateStore(thread.messagePaginator.state, latestReplySelector) ?? {}; + const { displayTitle: channelDisplayTitle } = useChannelPreviewInfo({ channel }); const { t } = useTranslationContext('ThreadListItemUI'); const { open } = useChatViewNavigation();