Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: useLayout effect cleanup in dev mode for charts (#5505)

Aakansha Doshi46f5ce5ce052
diff --git a/src/components/PasteChartDialog.tsx b/src/components/PasteChartDialog.tsx
index fb024e8d36..bb5bfc5715 100644
--- a/src/components/PasteChartDialog.tsx
+++ b/src/components/PasteChartDialog.tsx
@@ -46,7 +46,7 @@ const ChartPreviewBtn = (props: {
},
null, // files
);
-
+ previewNode.replaceChildren();
previewNode.appendChild(svg);
if (props.selected) {
@@ -55,7 +55,7 @@ const ChartPreviewBtn = (props: {
})();
return () => {
- previewNode.removeChild(svg);
+ previewNode.replaceChildren();
};
}, [props.spreadsheet, props.chartType, props.selected]);