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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 = (

View File

@ -557,7 +557,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
try:
json_body = json.loads(request.form["form_data"])
except (TypeError, json.JSONDecodeError):
json_body = None
pass
if json_body is None:
return self.response_400(message=_("Request is not JSON"))