fix: move useCallback before early returns to fix hooks order

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-30 17:47:17 +02:00
parent 1b9a3b84a0
commit 2f2f93f37e

View File

@@ -120,6 +120,18 @@ export function ExecutionDiagram({
} }
}, [detail?.processors]); }, [detail?.processors]);
const handleDownloadJson = useCallback(() => {
if (!detail) return;
const json = JSON.stringify(detail, null, 2);
const blob = new Blob([json], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `execution-${executionId}.json`;
a.click();
URL.revokeObjectURL(url);
}, [detail, executionId]);
// Loading state // Loading state
if (detailLoading || (detail && diagramLoading)) { if (detailLoading || (detail && diagramLoading)) {
return ( return (
@@ -154,18 +166,6 @@ export function ExecutionDiagram({
); );
} }
const handleDownloadJson = useCallback(() => {
if (!detail) return;
const json = JSON.stringify(detail, null, 2);
const blob = new Blob([json], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `execution-${executionId}.json`;
a.click();
URL.revokeObjectURL(url);
}, [detail, executionId]);
return ( return (
<div ref={containerRef} className={`${styles.executionDiagram} ${className ?? ''}`}> <div ref={containerRef} className={`${styles.executionDiagram} ${className ?? ''}`}>
{/* Diagram area */} {/* Diagram area */}