From a39a5fdd97cbeea21052ca82b92ca2d52c755ebe Mon Sep 17 00:00:00 2001 From: Sayo Date: Fri, 31 Oct 2025 08:25:44 +0800 Subject: [PATCH] fix: fix the violation by moving useState to the top --- src/components/ChatInterface.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ChatInterface.jsx b/src/components/ChatInterface.jsx index 7e53797..82a7201 100644 --- a/src/components/ChatInterface.jsx +++ b/src/components/ChatInterface.jsx @@ -197,6 +197,7 @@ const safeLocalStorage = { // Common markdown components to ensure consistent rendering (tables, inline code, links, etc.) const markdownComponents = { code: ({ node, inline, className, children, ...props }) => { + const [copied, setCopied] = React.useState(false); const raw = Array.isArray(children) ? children.join('') : String(children ?? ''); const looksMultiline = /[\r\n]/.test(raw); const inlineDetected = inline || (node && node.type === 'inlineCode'); @@ -213,7 +214,6 @@ const markdownComponents = { ); } - const [copied, setCopied] = React.useState(false); const textToCopy = raw; const handleCopy = () => {