cheogram-www
created pr with
cheogram-www/new-chat2.1
commented
lgtm
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:new-chat2 | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:new-chat2 [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:new-chat2add comment to patch request:
ssh pr.pico.sh comment cheogram-www:new-chat2 "lgtm!"
Patchset
cheogram-www/new-chat2.1
New Chat search clear button
Stephen Paul Weber
2026-11-17T04:41:51ZDiff stat
2 files changed, 28 insertions(+)
Semantic diff summary
0 added,
1 modified,
0 signature changed,
0 removed
across 2 analyzed files
+12
-0
src/components/NewChatDialog.test.tsx
#
| ... | ... | @@ -112,6 +112,18 @@ describe("NewChatDialog", () => { | |
| 112 | 112 | ); | |
| 113 | 113 | }); | |
| 114 | 114 | ||
| 115 | + | it("clears the search query", async () => { | |
| 116 | + | const alice = availableChat("alice@example.com", "Alice"); | |
| 117 | + | setup([alice]); | |
| 118 | + | ||
| 119 | + | await search("Ali", "Alice"); | |
| 120 | + | ||
| 121 | + | fireEvent.click(screen.getByRole("button", { name: "Clear search" })); | |
| 122 | + | ||
| 123 | + | expect((screen.getByRole("textbox") as HTMLInputElement).value).toBe(""); | |
| 124 | + | expect(screen.queryByText("Alice")).toBeNull(); | |
| 125 | + | }); | |
| 126 | + | ||
| 115 | 127 | it("selects the only chat found after scanning a QR code", async () => { | |
| 116 | 128 | const alice = availableChat("alice@example.com", "Alice"); | |
| 117 | 129 | const { startChat, onStarted, chat } = setup([alice]); |
+16
-0
src/components/NewChatDialog.tsx
#
| ... | ... | @@ -314,6 +315,21 @@ export const NewChatDialog = ({ | |
| 314 | 315 | {currentQuery !== "" && !searchComplete && !error && ( | |
| 315 | 316 | <CircularProgress size={20} /> | |
| 316 | 317 | )} | |
| 318 | + | {query !== "" && ( | |
| 319 | + | <IconButton | |
| 320 | + | aria-label="Clear search" | |
| 321 | + | title="Clear search" | |
| 322 | + | onClick={() => { | |
| 323 | + | setQuery(""); | |
| 324 | + | setResults({ q: "", chats: [] }); | |
| 325 | + | setCompletedQuery(null); | |
| 326 | + | setError(null); | |
| 327 | + | }} | |
| 328 | + | disabled={starting !== null} | |
| 329 | + | > | |
| 330 | + | <ClearIcon /> | |
| 331 | + | </IconButton> | |
| 332 | + | )} | |
| 317 | 333 | <IconButton | |
| 318 | 334 | aria-label="Scan QR Code" | |
| 319 | 335 | title="Scan QR Code" |