From 8cd32d57614d156f152a024131cec0462bffb1c0 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:54:16 +0300 Subject: [PATCH] Sort chat rooms by recency --- app/components/layout/ChatSidebar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/layout/ChatSidebar.tsx b/app/components/layout/ChatSidebar.tsx index 68feb5b8c..f3826ecff 100644 --- a/app/components/layout/ChatSidebar.tsx +++ b/app/components/layout/ChatSidebar.tsx @@ -66,7 +66,9 @@ function RoomList({ onClose }: { onClose?: () => void }) { .filter((room) => room.expiresAt > Date.now()) .sort((a, b) => { if (a.isObsolete !== b.isObsolete) return a.isObsolete ? 1 : -1; - return 0; + const aRecency = a.lastMessageTimestamp || a.createdAt; + const bRecency = b.lastMessageTimestamp || b.createdAt; + return bRecency - aRecency; }); return (