mirror of
https://github.com/siteboon/claudecodeui.git
synced 2025-12-08 22:59:39 +00:00
fix: fix the violation by moving useState to the top
This commit is contained in:
@@ -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 = {
|
||||
</code>
|
||||
);
|
||||
}
|
||||
const [copied, setCopied] = React.useState(false);
|
||||
const textToCopy = raw;
|
||||
|
||||
const handleCopy = () => {
|
||||
|
||||
Reference in New Issue
Block a user