cheogram-www

created pr with cheogram-www/new-chat2.1 on 2026-11-17T04:43:56Z · by 9e834e0d
commented on 2026-11-18T17:30:15Z · by 3c31bc8c
lgtm
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:new-chat2 | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:new-chat2 [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:new-chat2
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:new-chat2 "lgtm!"
+12 -0 src/components/NewChatDialog.test.tsx #
......@@ -112,6 +112,18 @@ describe("NewChatDialog", () => {
112112 );
113113 });
114114
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+
115127 it("selects the only chat found after scanning a QR code", async () => {
116128 const alice = availableChat("alice@example.com", "Alice");
117129 const { startChat, onStarted, chat } = setup([alice]);
+16 -0 src/components/NewChatDialog.tsx #
......@@ -17,6 +17,7 @@ import {
1717 Stack,
1818 TextField,
1919 } from "@mui/material";
20+import ClearIcon from "@mui/icons-material/Clear";
2021 import QrCodeScannerIcon from "@mui/icons-material/QrCodeScanner";
2122 import { useDebounce } from "../hooks/use-debounce";
2223
......@@ -314,6 +315,21 @@ export const NewChatDialog = ({
314315 {currentQuery !== "" && !searchComplete && !error && (
315316 <CircularProgress size={20} />
316317 )}
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+ )}
317333 <IconButton
318334 aria-label="Scan QR Code"
319335 title="Scan QR Code"
Back to top