From f74e7ba83ce4de319eccc3406749ccf60602da51 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Wed, 15 Jul 2026 16:15:08 -0700 Subject: [PATCH] Fix mobile and sorting --- apps/mobile/src/features/threads/threadListV2.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/mobile/src/features/threads/threadListV2.ts b/apps/mobile/src/features/threads/threadListV2.ts index ea3bbf41b4..da1b19969f 100644 --- a/apps/mobile/src/features/threads/threadListV2.ts +++ b/apps/mobile/src/features/threads/threadListV2.ts @@ -36,7 +36,9 @@ export function resolveThreadListV2Status( export function sortThreadsForListV2( threads: readonly T[], ): T[] { - return [...threads].toSorted( + // .sort() on a copy, not .toSorted(): Hermes doesn't ship the ES2023 + // change-by-copy array methods. + return [...threads].sort( (left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt) || left.id.localeCompare(right.id), ); @@ -84,7 +86,7 @@ export function buildThreadListV2Items(input: { } const orderedActive = sortThreadsForListV2(active); - const orderedSettled = settled.toSorted( + const orderedSettled = [...settled].sort( (left, right) => Date.parse(right.latestUserMessageAt ?? right.updatedAt) - Date.parse(left.latestUserMessageAt ?? left.updatedAt),