From beb4e5f805b6100ecc0e1e3757c2c4395cc08e94 Mon Sep 17 00:00:00 2001 From: zb-zhoufengen Date: Thu, 30 Apr 2026 12:11:56 +0800 Subject: [PATCH] fix(frontend): fix multiple UI bugs and improve robustness - Add null guard in useRenameThread to prevent runtime crash when query cache is empty, matching existing pattern in useDeleteThread - Check response.ok in loadArtifactContent before reading body to avoid displaying error HTML as artifact content - Handle clipboard API failure in CopyButton to avoid showing false "copied" state - Replace invalid ARIA roles with data attributes in message skeleton - Fix TodoList dark mode by replacing hardcoded bg-white with theme aware class - Remove console.log statements from production code paths Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- frontend/src/components/workspace/copy-button.tsx | 12 ++++++++---- .../src/components/workspace/messages/skeleton.tsx | 4 ++-- frontend/src/components/workspace/todo-list.tsx | 2 +- frontend/src/core/api/api-client.ts | 1 - frontend/src/core/artifacts/loader.ts | 3 +++ frontend/src/core/config/index.ts | 4 ---- frontend/src/core/threads/hooks.ts | 5 ++++- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/workspace/copy-button.tsx b/frontend/src/components/workspace/copy-button.tsx index 13d331b578..1c83c234fc 100644 --- a/frontend/src/components/workspace/copy-button.tsx +++ b/frontend/src/components/workspace/copy-button.tsx @@ -14,10 +14,14 @@ export function CopyButton({ }) { const { t } = useI18n(); const [copied, setCopied] = useState(false); - const handleCopy = useCallback(() => { - void navigator.clipboard.writeText(clipboardData); - setCopied(true); - setTimeout(() => setCopied(false), 2000); + const handleCopy = useCallback(async () => { + try { + await navigator.clipboard.writeText(clipboardData); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } catch { + // Clipboard write failed (e.g. permissions denied), do not show copied state + } }, [clipboardData]); return ( diff --git a/frontend/src/components/workspace/messages/skeleton.tsx b/frontend/src/components/workspace/messages/skeleton.tsx index f94604e477..db07ff6499 100644 --- a/frontend/src/components/workspace/messages/skeleton.tsx +++ b/frontend/src/components/workspace/messages/skeleton.tsx @@ -26,7 +26,7 @@ export function MessageListSkeleton() { return (
-
+