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]);
|
}, [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 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user