Skip to content

Commit cc8097d

Browse files
committed
fix(mobile): unsent drafts lead the thread list, matching web
The web sidebar shows unsent drafts above every thread, but mobile spliced drafts and queued tasks below the active block, so with a busy inbox they landed far down the list. Mobile now puts the Unsent group first in both the phone home list and the iPad sidebar.
1 parent a9c9c7c commit cc8097d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎apps/mobile/src/features/threads/threadListV2.test.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ describe("buildThreadListV2ListItems", () => {
11541154
now: NOW,
11551155
});
11561156

1157-
it("splices queued tasks between the active block and the settled tail", () => {
1157+
it("leads the list with queued tasks, above the active block", () => {
11581158
const items = buildThreadListV2ListItems({
11591159
items: layout.items,
11601160
pendingTasks: [makePendingTask("queued-1"), makePendingTask("queued-2")],
@@ -1172,13 +1172,13 @@ describe("buildThreadListV2ListItems", () => {
11721172
? "snoozed-shelf"
11731173
: "settled-shelf",
11741174
),
1175-
).toEqual(["active", "queued-1", "queued-2", "settled-shelf", "settled"]);
1175+
).toEqual(["queued-1", "queued-2", "active", "settled-shelf", "settled"]);
11761176
expect(
11771177
items.filter((item) => item.type === "v2-pending" && item.showPendingDivider),
11781178
).toHaveLength(1);
11791179
});
11801180

1181-
it("ends the list with queued tasks when nothing has settled yet", () => {
1181+
it("puts queued tasks above active rows when nothing has settled yet", () => {
11821182
const activeOnly = buildThreadListV2Items({
11831183
threads: [makeThread({ id: ThreadId.make("active"), title: "active" })],
11841184
environmentId: null,
@@ -1190,7 +1190,7 @@ describe("buildThreadListV2ListItems", () => {
11901190
pendingTasks: [makePendingTask("queued-1")],
11911191
});
11921192

1193-
expect(items.map((item) => item.type)).toEqual(["v2-thread", "v2-pending"]);
1193+
expect(items.map((item) => item.type)).toEqual(["v2-pending", "v2-thread"]);
11941194
});
11951195

11961196
it("keeps the settled shelf between active and settled rows when nothing is queued", () => {
@@ -1208,7 +1208,7 @@ describe("buildThreadListV2ListItems", () => {
12081208
]);
12091209
});
12101210

1211-
it("places queued tasks before a collapsed snoozed shelf", () => {
1211+
it("places queued tasks above active rows and a collapsed snoozed shelf", () => {
12121212
const snoozedLayout = buildThreadListV2Items({
12131213
threads: [
12141214
makeThread({ id: ThreadId.make("active"), title: "active" }),
@@ -1240,8 +1240,8 @@ describe("buildThreadListV2ListItems", () => {
12401240
});
12411241

12421242
expect(items.map((item) => item.type)).toEqual([
1243-
"v2-thread",
12441243
"v2-pending",
1244+
"v2-thread",
12451245
"v2-snoozed-shelf",
12461246
"v2-settled-shelf",
12471247
"v2-thread",
@@ -2132,7 +2132,7 @@ describe("buildThreadListV2ListItems trailing dividers", () => {
21322132
const dividers = items.map((item) =>
21332133
item.type === "v2-thread" || item.type === "v2-pending" ? item.showTrailingDivider : "n/a",
21342134
);
2135-
expect(dividers).toEqual([true, false, true, false]);
2135+
expect(dividers).toEqual([true, true, true, false]);
21362136
});
21372137
});
21382138

@@ -2370,8 +2370,8 @@ describe("Working section beta", () => {
23702370
: item.type,
23712371
),
23722372
).toEqual([
2373-
"active",
23742373
"queued",
2374+
"active",
23752375
"v2-working-shelf",
23762376
"working",
23772377
"v2-snoozed-shelf",

‎apps/mobile/src/features/threads/threadListV2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ export function buildThreadListV2ListItems(input: {
476476
const snoozedEnd = settledShelfHeaderIndex ?? threadItems.length;
477477
const workingEnd = snoozedShelfHeaderIndex ?? snoozedEnd;
478478
const activeEnd = workingShelfHeaderIndex ?? workingEnd;
479-
const result: ThreadListV2ListItem[] = [...threadItems.slice(0, activeEnd), ...pendingItems];
479+
const result: ThreadListV2ListItem[] = [...pendingItems, ...threadItems.slice(0, activeEnd)];
480480
const shelfDisabled = input.shelfPreferencesLoading === true;
481481
if (workingShelfHeaderIndex !== null && workingCount > 0) {
482482
result.push({

0 commit comments

Comments
 (0)