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:
@@ -120,6 +120,18 @@ export function ExecutionDiagram({
|
||||
}
|
||||
}, [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
|
||||
if (detailLoading || (detail && diagramLoading)) {
|
||||
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 (
|
||||
<div ref={containerRef} className={`${styles.executionDiagram} ${className ?? ''}`}>
|
||||
{/* Diagram area */}
|
||||
|
||||
Reference in New Issue
Block a user