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

This commit is contained in:
Aakansha Doshi 2022-07-29 17:25:26 +05:30 committed by GitHub
parent b00bd3d6c0
commit 46f5ce5ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,7 @@ const ChartPreviewBtn = (props: {
}, },
null, // files null, // files
); );
previewNode.replaceChildren();
previewNode.appendChild(svg); previewNode.appendChild(svg);
if (props.selected) { if (props.selected) {
@ -55,7 +55,7 @@ const ChartPreviewBtn = (props: {
})(); })();
return () => { return () => {
previewNode.removeChild(svg); previewNode.replaceChildren();
}; };
}, [props.spreadsheet, props.chartType, props.selected]); }, [props.spreadsheet, props.chartType, props.selected]);