The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 01:45 UTC
fix(mobile): unsent drafts lead the thread list, matching web (#19818)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Tristan Knight committed
Oct 19, 2026 at 22:10 UTC
a064567a4760b30bcbe0fed0726c3930d2204b4a
2 files changed
+37
-12
apps/mobile/src/features/threads/threadListV2.test.ts
+36
-11
@@ -1154,10 +1154,30 @@ describe("buildThreadListV2ListItems", () => {
1154
now: NOW,
1155
});
1156
1157
- it("splices queued tasks between the active block and the settled tail", () => {
1157
+ it("leads the list with unsent drafts and queued tasks, preserving section dividers", () => {
1158
const items = buildThreadListV2ListItems({
1159
items: layout.items,
1160
- pendingTasks: [makePendingTask("queued-1"), makePendingTask("queued-2")],
1160
+ pendingTasks: [
1161
+ {
1162
+ kind: "draft",
1163
+ key: "draft-task:new-task:unsent",
1164
+ environmentId,
1165
+ projectId: ProjectId.make("project-1"),
1166
+ projectTitle: undefined,
1167
+ projectCwd: undefined,
1168
+ branch: null,
1169
+ title: "unsent",
1170
+ createdAt: NOW,
1171
+ draftKey: "new-task:unsent",
1172
+ draft: {
1173
+ text: "unsent",
1174
+ attachments: [],
1175
+ project: { environmentId, projectId: ProjectId.make("project-1"), createdAt: NOW },
1176
+ },
1177
+ },
1178
+ makePendingTask("queued-1"),
1179
+ makePendingTask("queued-2"),
1180
+ ],
1181
settledCount: layout.settledCount,
1182
settledShelfHeaderIndex: layout.settledShelfHeaderIndex,
1183
});
@@ -1172,13 +1192,18 @@ describe("buildThreadListV2ListItems", () => {
1192
? "snoozed-shelf"
1193
: "settled-shelf",
1194
),
1175
- ).toEqual(["active", "queued-1", "queued-2", "settled-shelf", "settled"]);
1195
+ ).toEqual(["unsent", "queued-1", "queued-2", "active", "settled-shelf", "settled"]);
1196
expect(
1177
- items.filter((item) => item.type === "v2-pending" && item.showPendingDivider),
1178
- ).toHaveLength(1);
1197
+ items.flatMap((item) => (item.type === "v2-pending" ? [item.showPendingDivider] : [])),
1198
+ ).toEqual([true, false, false]);
1199
+ expect(
1200
+ items.map((item) =>
1201
+ item.type === "v2-thread" || item.type === "v2-pending" ? item.showTrailingDivider : null,
1202
+ ),
1203
+ ).toEqual([true, true, true, false, null, false]);
1204
});
1205
1181
- it("ends the list with queued tasks when nothing has settled yet", () => {
1206
+ it("puts queued tasks above active rows when nothing has settled yet", () => {
1207
const activeOnly = buildThreadListV2Items({
1208
threads: [makeThread({ id: ThreadId.make("active"), title: "active" })],
1209
environmentId: null,
@@ -1190,7 +1215,7 @@ describe("buildThreadListV2ListItems", () => {
1215
pendingTasks: [makePendingTask("queued-1")],
1216
});
1217
1193
- expect(items.map((item) => item.type)).toEqual(["v2-thread", "v2-pending"]);
1218
+ expect(items.map((item) => item.type)).toEqual(["v2-pending", "v2-thread"]);
1219
});
1220
1221
it("keeps the settled shelf between active and settled rows when nothing is queued", () => {
@@ -1208,7 +1233,7 @@ describe("buildThreadListV2ListItems", () => {
1233
]);
1234
});
1235
1211
- it("places queued tasks before a collapsed snoozed shelf", () => {
1236
+ it("places queued tasks above active rows and a collapsed snoozed shelf", () => {
1237
const snoozedLayout = buildThreadListV2Items({
1238
threads: [
1239
makeThread({ id: ThreadId.make("active"), title: "active" }),
@@ -1240,8 +1265,8 @@ describe("buildThreadListV2ListItems", () => {
1265
});
1266
1267
expect(items.map((item) => item.type)).toEqual([
1243
- "v2-thread",
1268
"v2-pending",
1269
+ "v2-thread",
1270
"v2-snoozed-shelf",
1271
"v2-settled-shelf",
1272
"v2-thread",
@@ -2132,7 +2157,7 @@ describe("buildThreadListV2ListItems trailing dividers", () => {
2157
const dividers = items.map((item) =>
2158
item.type === "v2-thread" || item.type === "v2-pending" ? item.showTrailingDivider : "n/a",
2159
);
2135
- expect(dividers).toEqual([true, false, true, false]);
2160
+ expect(dividers).toEqual([true, true, true, false]);
2161
});
2162
});
2163
@@ -2370,8 +2395,8 @@ describe("Working section beta", () => {
2395
: item.type,
2396
),
2397
).toEqual([
2373
- "active",
2398
"queued",
2399
+ "active",
2400
"v2-working-shelf",
2401
"working",
2402
"v2-snoozed-shelf",
apps/mobile/src/features/threads/threadListV2.ts
+1
-1
@@ -476,7 +476,7 @@ export function buildThreadListV2ListItems(input: {
476
const snoozedEnd = settledShelfHeaderIndex ?? threadItems.length;
477
const workingEnd = snoozedShelfHeaderIndex ?? snoozedEnd;
478
const activeEnd = workingShelfHeaderIndex ?? workingEnd;
479
- const result: ThreadListV2ListItem[] = [...threadItems.slice(0, activeEnd), ...pendingItems];
479
+ const result: ThreadListV2ListItem[] = [...pendingItems, ...threadItems.slice(0, activeEnd)];
480
const shelfDisabled = input.shelfPreferencesLoading === true;
481
if (workingShelfHeaderIndex !== null && workingCount > 0) {
482
result.push({