diff --git a/src/components/molecules/RunContent.tsx b/src/components/molecules/RunContent.tsx index 445cfac1..0c163368 100644 --- a/src/components/molecules/RunContent.tsx +++ b/src/components/molecules/RunContent.tsx @@ -31,18 +31,23 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe setTab(tab); }, [interpretationInProgress]); - useEffect(() => { - if (row.serializableOutput && Object.keys(row.serializableOutput).length > 0) { - const firstKey = Object.keys(row.serializableOutput)[0]; - const data = row.serializableOutput[firstKey]; - if (Array.isArray(data)) { - setTableData(data); - if (data.length > 0) { - setColumns(Object.keys(data[0])); - } +useEffect(() => { + if (row.serializableOutput && Object.keys(row.serializableOutput).length > 0) { + const firstKey = Object.keys(row.serializableOutput)[0]; + const data = row.serializableOutput[firstKey]; + if (Array.isArray(data)) { + // Filter out completely empty rows + const filteredData = data.filter(row => + Object.values(row).some(value => value !== undefined && value !== "") + ); + setTableData(filteredData); + if (filteredData.length > 0) { + setColumns(Object.keys(filteredData[0])); } } - }, [row.serializableOutput]); + } +}, [row.serializableOutput]); + // Function to convert table data to CSV format const convertToCSV = (data: any[], columns: string[]): string => {