From b5db980f696446dbcc14e4e748552cbc3e754576 Mon Sep 17 00:00:00 2001 From: Dayuan Jiang <34411969+DayuanJiang@users.noreply.github.com> Date: Fri, 12 Dec 2025 14:06:53 +0900 Subject: [PATCH] fix: add user feedback for clipboard copy failures (#236) Add toast notification when clipboard copy operation fails, so users know when their copy attempt was unsuccessful. Changes: - Add toast import from sonner - Add toast.error() notification when clipboard copy fails - Show clear message: "Failed to copy message. Please copy manually or check clipboard permissions." Previously, clipboard copy failures were only indicated by a brief visual state change (setCopyFailedMessageId), which users might miss. Now users receive persistent feedback when copy operations fail. --- components/chat-message-display.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/chat-message-display.tsx b/components/chat-message-display.tsx index 0f0f11f..8b4c92a 100644 --- a/components/chat-message-display.tsx +++ b/components/chat-message-display.tsx @@ -22,6 +22,7 @@ import Image from "next/image" import type { MutableRefObject } from "react" import { useCallback, useEffect, useRef, useState } from "react" import ReactMarkdown from "react-markdown" +import { toast } from "sonner" import { Reasoning, ReasoningContent, @@ -234,6 +235,9 @@ export function ChatMessageDisplay({ setTimeout(() => setCopiedMessageId(null), 2000) } catch (fallbackErr) { console.error("Failed to copy message:", fallbackErr) + toast.error( + "Failed to copy message. Please copy manually or check clipboard permissions.", + ) setCopyFailedMessageId(messageId) setTimeout(() => setCopyFailedMessageId(null), 2000) } finally {