Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,9 @@ export default function Sidebar() {
const latestThread = threads
.filter((thread) => thread.projectId === projectId)
.toSorted((a, b) => {
const byDate = new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
if (byDate !== 0) return byDate;
const aTime = a.messages.at(-1)?.createdAt ?? a.createdAt;
const bTime = b.messages.at(-1)?.createdAt ?? b.createdAt;
if (aTime !== bTime) return bTime.localeCompare(aTime);
return b.id.localeCompare(a.id);
})[0];
if (!latestThread) return;
Expand Down Expand Up @@ -1296,9 +1297,9 @@ export default function Sidebar() {
const projectThreads = threads
.filter((thread) => thread.projectId === project.id)
.toSorted((a, b) => {
const byDate =
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
if (byDate !== 0) return byDate;
const aTime = a.messages.at(-1)?.createdAt ?? a.createdAt;
const bTime = b.messages.at(-1)?.createdAt ?? b.createdAt;
if (aTime !== bTime) return bTime.localeCompare(aTime);
return b.id.localeCompare(a.id);
});
const isThreadListExpanded = expandedThreadListsByProject.has(project.id);
Expand Down