@devries-cameron20 / t3code Mirror · read-only / commits / 1c9d32fe3c
Fork 0

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 21, 19:45 UTC

fix(shared): composer # suggestions sort by update instant, not timestamp text (#35137)

Julius Marminge committed Nov 12, 2026 at 03:00 UTC 1c9d32fe3ca3ef236d2f517a68b2b82f565a5bf7
2 files changed +13 -1
packages/shared/src/composerPullRequestMatches.test.ts
+11
@@ -26,6 +26,17 @@ describe("filterComposerPullRequestMatches", () => {
26 });
27 expect(result.map((match) => match.number)).toEqual([123, 1234, 1230]);
28 });
29 +
30 + it("orders by update instant when timestamps carry different UTC offsets", () => {
31 + const result = filterComposerPullRequestMatches({
32 + entries: [entry(401, "2026-10-25T02:50:00+02:00"), entry(499, "2026-10-25T02:10:00+01:00")],
33 + projectId: "p1",
34 + repository: "owner/repo",
35 + query: "4",
36 + limit: 1,
37 + });
38 + expect(result.map((match) => match.number)).toEqual([499]);
39 + });
40 });
41
42 describe("linked pull requests", () => {
packages/shared/src/composerPullRequestMatches.ts
+2 -1
@@ -63,13 +63,14 @@ export function filterComposerPullRequestMatches<
63 }
64 const isExactMatch = (entry: ComposerPullRequestMatch) => String(entry.number) === input.query;
65 const isLinked = (entry: ComposerPullRequestMatch) => linkedKeys.has(keyOf(entry));
66 + const updatedAtMs = (entry: ComposerPullRequestMatch) => Date.parse(entry.updatedAt) || 0;
67 // Hermes has no ES2023 array methods, so sort a fresh array.
68 return [...uniqueEntries.values()]
69 .sort(
70 (left, right) =>
71 Number(isExactMatch(right)) - Number(isExactMatch(left)) ||
72 Number(isLinked(right)) - Number(isLinked(left)) ||
72 - right.updatedAt.localeCompare(left.updatedAt),
73 + updatedAtMs(right) - updatedAtMs(left),
74 )
75 .slice(0, input.limit);
76 }