Skip to content

Fix: new projects sort to top of sidebar#123

Merged
BunsDev merged 2 commits intomainfrom
copilot/fix-new-project-sidebar-sort
Mar 31, 2026
Merged

Fix: new projects sort to top of sidebar#123
BunsDev merged 2 commits intomainfrom
copilot/fix-new-project-sidebar-sort

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

New projects with no threads were sinking to the bottom of the sidebar because getProjectSortTimestamp() had no fallback for the threadless case — returning Number.NEGATIVE_INFINITY and losing to any project with thread activity.

What Changed

  • Sidebar.logic.ts: getProjectSortTimestamp() uses project.updatedAt ?? project.createdAt as the sort key when a project has no threads, so a freshly created project carries its creation timestamp into the sort comparison rather than -Infinity
  • Sidebar.logic.test.ts: Added the cross-scenario test that was missing — new project (no threads, createdAt = T+10min) vs. older project with a recent user message (T+5min); asserts new project sorts first
  • TODO.md: Marked "New projects should go on top" complete

Why

updated_at sort derives its key from child thread user-message timestamps. A project with zero threads had no such timestamp, so it always fell below every project that had any thread activity at all. Using the project's own createdAt as a fallback makes the sort semantically consistent: a just-created project is treated as recently active until it accumulates thread history.

UI Changes

N/A

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Copilot AI linked an issue Mar 31, 2026 that may be closed by this pull request
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
okcode-marketing Ready Ready Preview Mar 31, 2026 9:58pm

Copilot AI changed the title [WIP] Fix new projects sorting to top of sidebar Fix: new projects sort to top of sidebar Mar 31, 2026
Copilot AI requested a review from BunsDev March 31, 2026 21:59
@BunsDev BunsDev marked this pull request as ready for review March 31, 2026 22:34
@BunsDev BunsDev merged commit 1f79041 into main Mar 31, 2026
10 of 14 checks passed
@github-actions github-actions bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Mar 31, 2026
@BunsDev BunsDev deleted the copilot/fix-new-project-sidebar-sort branch April 1, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New projects should sort to top of sidebar

2 participants