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, 04:45 UTC
fix(web): fold accents in thread link picker search (#39557)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Wout Stiens committed
Nov 20, 2026 at 08:25 UTC
732c03f410e6622fa721fdd018b6eab6004e3247
4 files changed
+110
-4
apps/web/src/components/ThreadLinkPicker.logic.test.ts
new
+11
@@ -0,0 +1,11 @@
1
+import { expect, it } from "vite-plus/test";
2
+
3
+import { threadLinkMatcher } from "./ThreadLinkPicker.logic";
4
+
5
+it.each([
6
+ ["cafe", "Café planning", undefined],
7
+ ["café", "Café planning", undefined],
8
+ ["ışık", "Işık planı", "tr-TR"],
9
+])("matches %s against %s", (query, text, locale) => {
10
+ expect(threadLinkMatcher(query, locale)(text)).toBe(true);
11
+});
apps/web/src/components/ThreadLinkPicker.logic.ts
new
+9
@@ -0,0 +1,9 @@
1
+import { normalizeSearchText } from "~/lib/utils";
2
+
3
+export function threadLinkMatcher(query: string, locale?: string) {
4
+ const localQuery = query.trim().toLocaleLowerCase(locale);
5
+ const foldedQuery = normalizeSearchText(query);
6
+ return (text: string) =>
7
+ text.toLocaleLowerCase(locale).includes(localQuery) ||
8
+ normalizeSearchText(text).includes(foldedQuery);
9
+}
apps/web/src/components/ThreadLinkPicker.tsx
+3
-4
@@ -6,6 +6,7 @@ import { useState } from "react";
6
import { useProjects, useVisibleThreadShells } from "~/state/entities";
7
import { useThreadSearch } from "~/state/queries";
8
9
+import { threadLinkMatcher } from "./ThreadLinkPicker.logic";
10
import { Command, CommandInput, CommandItem, CommandList } from "./ui/command";
11
12
type ThreadShell = ReturnType<typeof useVisibleThreadShells>[number];
@@ -33,15 +34,13 @@ export function ThreadLinkPicker({
34
.filter((project) => project.environmentId === environmentId)
35
.map((project) => [project.id, project.title]),
36
);
36
- const search = query.trim().toLocaleLowerCase();
37
+ const matches = threadLinkMatcher(query);
38
const candidates = threads
39
.filter(
40
(thread) =>
41
thread.environmentId === environmentId &&
42
thread.archivedAt === null &&
42
- `${thread.title} ${projectNames.get(thread.projectId) ?? ""}`
43
- .toLocaleLowerCase()
44
- .includes(search),
43
+ matches(`${thread.title} ${projectNames.get(thread.projectId) ?? ""}`),
44
)
45
.toSorted((a, b) => b.updatedAt.localeCompare(a.updatedAt));
46
return (
scripts/scenarios/issue-link-picker-finds-accented-thread.e2e.ts
new
+87
@@ -0,0 +1,87 @@
1
+/// <reference lib="dom" />
2
+import type { IssueDetail, IssueRef } from "@t3tools/contracts";
3
+import { expect } from "e2e";
4
+
5
+import { test, WEB } from "./t3.ts";
6
+
7
+test(
8
+ "The issue link picker finds a thread title without its accent",
9
+ WEB,
10
+ async ({ t3, app, browser, screen }) => {
11
+ const project = await t3.project("demo");
12
+ await t3.thread({ project, title: "Café planning", messages: ["first"] });
13
+ await browser.addInitScript(() => {
14
+ const send = WebSocket.prototype.send;
15
+ WebSocket.prototype.send = function (data) {
16
+ const request: { _tag: string; id: string; tag: string; payload: IssueRef } | null =
17
+ typeof data === "string" ? JSON.parse(data) : null;
18
+ if (request?._tag !== "Request" || request.tag !== "issues.detail")
19
+ return send.call(this, data);
20
+ const reply = (exit: unknown) =>
21
+ this.dispatchEvent(
22
+ new MessageEvent("message", {
23
+ data: JSON.stringify({ _tag: "Exit", requestId: request.id, exit }),
24
+ }),
25
+ );
26
+ const { projectId, tracker, scope, key } = request.payload;
27
+ const detail: IssueDetail = {
28
+ projectId,
29
+ tracker,
30
+ scope,
31
+ key,
32
+ host: "github.com",
33
+ displayKey: "#42",
34
+ projectTitle: "demo",
35
+ title: "Publish the release notes",
36
+ body: "Check the release notes.",
37
+ url: "https://github.com/example/demo/issues/42",
38
+ author: null,
39
+ state: { category: "open", name: "Open" },
40
+ createdAt: "2026-10-01T00:00:00.000Z",
41
+ updatedAt: "2026-10-01T00:00:00.000Z",
42
+ closedAt: null,
43
+ assignees: [],
44
+ labels: [],
45
+ commentCount: 0,
46
+ writable: false,
47
+ capabilities: {
48
+ create: false,
49
+ edit: false,
50
+ comment: false,
51
+ labels: false,
52
+ assignees: false,
53
+ reactions: false,
54
+ templates: false,
55
+ linkedPullRequests: false,
56
+ events: false,
57
+ search: true,
58
+ },
59
+ viewerPermissions: {
60
+ setState: false,
61
+ comment: false,
62
+ edit: false,
63
+ assignees: false,
64
+ labels: false,
65
+ },
66
+ states: [],
67
+ viewer: null,
68
+ comments: [],
69
+ commentsCursor: null,
70
+ events: [],
71
+ linkedPullRequests: [],
72
+ };
73
+ queueMicrotask(() => reply({ _tag: "Success", value: detail }));
74
+ };
75
+ });
76
+
77
+ await t3.open("/issues?selectedProjectId=demo&tracker=github&scope=example/demo&key=42");
78
+ await screen.getByText("Publish the release notes", { exact: true }).waitFor();
79
+ await screen.getByRole("button", "Link to thread", { exact: true }).tap();
80
+ const dialog = screen.getByRole("dialog", "Link issue to a thread");
81
+ const thread = dialog.getByText("Café planning", { exact: true });
82
+ await thread.waitFor();
83
+ await dialog.getByPlaceholder("Search threads or projects...").fill("cafe");
84
+ await app.screenshot("issue-link-thread-search");
85
+ expect(await thread.isVisible(), "Searching for cafe keeps Café planning available").toBe(true);
86
+ },
87
+);