From 63eebb135291bb9e343469ea044ba8aa74cbee95 Mon Sep 17 00:00:00 2001 From: Kang Date: Sun, 10 May 2026 20:00:17 +0800 Subject: [PATCH] fix: Initialize timerRef in CopyButton component to avoid potential undefined behavior This commit updates the CopyButton component by initializing the timerRef with `undefined` to ensure proper type handling. This change enhances the reliability of the component's functionality when managing clipboard operations. --- src/components/panel/security-auth/CopyButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/panel/security-auth/CopyButton.tsx b/src/components/panel/security-auth/CopyButton.tsx index 1c7936c90..d558d1214 100644 --- a/src/components/panel/security-auth/CopyButton.tsx +++ b/src/components/panel/security-auth/CopyButton.tsx @@ -10,7 +10,7 @@ interface CopyButtonProps { export function CopyButton({ value }: CopyButtonProps) { const { t } = useTranslation(); const [copied, setCopied] = useState(false); - const timerRef = useRef>(); + const timerRef = useRef>(undefined); const handleCopy = () => { navigator.clipboard.writeText(value).catch(() => {});