From 9625f43aede852567c731251fa010788b4b71ce1 Mon Sep 17 00:00:00 2001 From: Speros Kokenes Date: Mon, 28 Oct 2024 14:50:42 -0400 Subject: [PATCH] fix: renderer hanging on copying data --- packages/malloy-render/src/component/chart/chart.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/malloy-render/src/component/chart/chart.tsx b/packages/malloy-render/src/component/chart/chart.tsx index 343d8ca31..a7ddfaa9b 100644 --- a/packages/malloy-render/src/component/chart/chart.tsx +++ b/packages/malloy-render/src/component/chart/chart.tsx @@ -29,12 +29,10 @@ export function Chart(props: { const {field, data} = props; const chartProps = props.metadata.field(field).vegaChartProps!; const spec = structuredClone(chartProps.spec); - const chartData = data.map(row => { - const rec = structuredClone(row); - // prevent structured clone from ripping out the QueryDataRow class - rec['__malloyDataRecord'] = row['__malloyDataRecord']; - return rec; - }); + const chartData = structuredClone(data); + for (let i = 0; i < chartData.length; i++) { + chartData[i]['__malloyDataRecord'] = data[i]['__malloyDataRecord']; + } // New vega charts use injectData handlers if (chartProps.injectData && chartProps.specType === 'vega') { chartProps.injectData(field, chartData, spec);