fix: chart disappears in standalone slice (#12606)

This commit is contained in:
Duy Nguyen Hoang
2021-01-20 02:56:24 +07:00
committed by GitHub
parent 68fe2208ba
commit 862ddd9cb4
2 changed files with 7 additions and 2 deletions

View File

@@ -203,6 +203,11 @@ const ExploreChartPanel = props => {
[chartRef, renderChart],
);
const standaloneChartBody = useMemo(
() => <div ref={chartRef}>{renderChart()}</div>,
[chartRef, renderChart],
);
if (props.standalone) {
// dom manipulation hack to get rid of the boostrap theme's body background
const standaloneClass = 'background-transparent';
@@ -210,7 +215,7 @@ const ExploreChartPanel = props => {
if (!bodyClasses.includes(standaloneClass)) {
document.body.className += ` ${standaloneClass}`;
}
return renderChart();
return standaloneChartBody;
}
const header = (