From 0b9bdcd8e822db96e1ccd9655431943713ce245e Mon Sep 17 00:00:00 2001 From: Wes Date: Thu, 2 Apr 2026 10:57:33 -0700 Subject: [PATCH] Sort project chats newest-first and increase show-more limit to 5 - Add descending updatedAt sort for project chat lists in sidebar so new chats appear at the top instead of the bottom - Increase MAX_VISIBLE_CHATS from 3 to 5 so more chats are visible before the 'Show more' button --- src/features/sidebar/ui/Sidebar.tsx | 8 ++++++++ src/features/sidebar/ui/SidebarProjectsSection.tsx | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/features/sidebar/ui/Sidebar.tsx b/src/features/sidebar/ui/Sidebar.tsx index cd6b08c..18aac3a 100644 --- a/src/features/sidebar/ui/Sidebar.tsx +++ b/src/features/sidebar/ui/Sidebar.tsx @@ -134,6 +134,14 @@ export function Sidebar({ standalone.push(item); } } + // Sort project chats by updatedAt descending (newest first) + for (const chats of Object.values(byProject)) { + chats.sort( + (a, b) => + new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), + ); + } + // Sort standalone by updatedAt descending, limit to MAX_RECENTS standalone.sort( (a, b) => diff --git a/src/features/sidebar/ui/SidebarProjectsSection.tsx b/src/features/sidebar/ui/SidebarProjectsSection.tsx index c4f1710..a21ad7b 100644 --- a/src/features/sidebar/ui/SidebarProjectsSection.tsx +++ b/src/features/sidebar/ui/SidebarProjectsSection.tsx @@ -12,7 +12,7 @@ import type { ProjectInfo } from "@/features/projects/api/projects"; import { SessionActivityIndicator } from "@/shared/ui/SessionActivityIndicator"; import { SidebarChatRow } from "./SidebarChatRow"; -const MAX_VISIBLE_CHATS = 3; +const MAX_VISIBLE_CHATS = 5; const PROJECT_ROW_TEXT_CLASS = "text-foreground-subtle group-hover:text-foreground";