Sort chat rooms by recency

This commit is contained in:
Kalle
2026-04-09 20:54:16 +03:00
parent b3b5e1ff96
commit 8cd32d5761

View File

@@ -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 (