Skip to content
Source
Sign inSign up
pingdotgg/t3code

Pick sidebar fallback thread after delete #1395

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/1395/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 106 additions and 2 deletions.

x
0 of 3 viewed, 3 left
71 additions and 0 deletionsapps/web/src/components/Sidebar.logic.test.tsModified
View file
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
​
import {
+ getFallbackThreadIdAfterDelete,
getVisibleThreadsForProject,
getProjectSortTimestamp,
hasUnseenCompletion,
@@ -516,6 +517,76 @@
});
});
​
+describe("getFallbackThreadIdAfterDelete", () => {
+ it("returns the top remaining thread in the deleted thread's project sidebar order", () => {
+ const fallbackThreadId = getFallbackThreadIdAfterDelete({
+ threads: [
+ makeThread({
+ id: ThreadId.makeUnsafe("thread-oldest"),
+ projectId: ProjectId.makeUnsafe("project-1"),
+ createdAt: "2026-03-09T10:00:00.000Z",
+ messages: [],
+ }),
+ makeThread({
+ id: ThreadId.makeUnsafe("thread-active"),
+ projectId: ProjectId.makeUnsafe("project-1"),
+ createdAt: "2026-03-09T10:05:00.000Z",
+ messages: [],
+ }),
+ makeThread({
+ id: ThreadId.makeUnsafe("thread-newest"),