Fix critical linting errors and React hooks violations

This commit is contained in:
Chris Scott committed 2025-12-07 23:51:17 -05:00
1 parent f48acfa06b
commit c1aa8ba101
4 files changed
+12 -12

No files matched your search

@@ -300,7 +300,7 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
)}
{showSaveButton && (
<Button variant="outline" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); shouldVirtualize ? handleVirtualizedSaveClick() : handleSave() }} disabled={isSaving || (shouldVirtualize && !hasVirtualizedChanges)} className="border-green-600 bg-green-600/10 text-green-600 hover:bg-green-600/20 h-7 w-7 p-0">
<Button variant="outline" size="sm" onClick={(e) => { e.stopPropagation(); e.preventDefault(); if (shouldVirtualize) { handleVirtualizedSaveClick(); } else { handleSave(); } }} disabled={isSaving || (shouldVirtualize && !hasVirtualizedChanges)} className="border-green-600 bg-green-600/10 text-green-600 hover:bg-green-600/20 h-7 w-7 p-0">
<Save className="w-3 h-3" />
</Button>
)}
+1 -1
View File
@@ -27,7 +27,7 @@ function CodeBlock({ children, className, ...props }: CodeBlockProps) {
if (typeof node === 'number') return node.toString()
if (Array.isArray(node)) return node.map(extractTextContent).join('')
if (React.isValidElement(node)) {
const element = node as React.ReactElement<any, any>
const element = node as React.ReactElement<Record<string, unknown>>
if (element.props.children) {
return extractTextContent(element.props.children as React.ReactNode)
}
@@ -16,14 +16,6 @@ export function KeyboardShortcuts() {
const [tempShortcuts, setTempShortcuts] = useState<Record<string, string>>({})
const [currentKeys, setCurrentKeys] = useState<string>('')
if (isLoading) {
return (
<div className="flex items-center justify-center py-12">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
)
}
const shortcuts = { ...DEFAULT_KEYBOARD_SHORTCUTS, ...preferences?.keyboardShortcuts, ...tempShortcuts }
const handleKeyDown = (e: KeyboardEvent, action: string) => {
@@ -105,7 +97,15 @@ export function KeyboardShortcuts() {
document.removeEventListener('keyup', handleGlobalKeyUp)
}
}
}, [recordingKey])
}, [recordingKey, handleKeyDown, handleKeyUp])
if (isLoading) {
return (
<div className="flex items-center justify-center py-12">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
)
}
return (
<div className="bg-card border border-border rounded-lg p-6">
@@ -71,7 +71,7 @@ export function McpManager({ config, onUpdate, onConfigUpdate }: McpManagerProps
if (!config) return
const currentMcp = (config.content?.mcp as Record<string, any>) || {}
const { [serverId]: deleted, ...rest } = currentMcp
const { [serverId]: _deleted, ...rest } = currentMcp
const updatedConfig = {
...config.content,