mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix: chart disappears in standalone slice (#12606)
This commit is contained in:
@@ -203,6 +203,11 @@ const ExploreChartPanel = props => {
|
|||||||
[chartRef, renderChart],
|
[chartRef, renderChart],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const standaloneChartBody = useMemo(
|
||||||
|
() => <div ref={chartRef}>{renderChart()}</div>,
|
||||||
|
[chartRef, renderChart],
|
||||||
|
);
|
||||||
|
|
||||||
if (props.standalone) {
|
if (props.standalone) {
|
||||||
// dom manipulation hack to get rid of the boostrap theme's body background
|
// dom manipulation hack to get rid of the boostrap theme's body background
|
||||||
const standaloneClass = 'background-transparent';
|
const standaloneClass = 'background-transparent';
|
||||||
@@ -210,7 +215,7 @@ const ExploreChartPanel = props => {
|
|||||||
if (!bodyClasses.includes(standaloneClass)) {
|
if (!bodyClasses.includes(standaloneClass)) {
|
||||||
document.body.className += ` ${standaloneClass}`;
|
document.body.className += ` ${standaloneClass}`;
|
||||||
}
|
}
|
||||||
return renderChart();
|
return standaloneChartBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
const header = (
|
const header = (
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
|
|||||||
try:
|
try:
|
||||||
json_body = json.loads(request.form["form_data"])
|
json_body = json.loads(request.form["form_data"])
|
||||||
except (TypeError, json.JSONDecodeError):
|
except (TypeError, json.JSONDecodeError):
|
||||||
json_body = None
|
pass
|
||||||
|
|
||||||
if json_body is None:
|
if json_body is None:
|
||||||
return self.response_400(message=_("Request is not JSON"))
|
return self.response_400(message=_("Request is not JSON"))
|
||||||
|
|||||||
Reference in New Issue
Block a user