Skip to content

Commit

Permalink
fix: chart disappears in standalone slice (#12606)
Browse files Browse the repository at this point in the history
  • Loading branch information
duynguyenhoang authored and dpgaspar committed Jan 20, 2021
1 parent d237cd6 commit 6e8d360
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,19 @@ 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';
const bodyClasses = document.body.className.split(' ');
if (!bodyClasses.includes(standaloneClass)) {
document.body.className += ` ${standaloneClass}`;
}
return renderChart();
return standaloneChartBody;
}

const header = (
Expand Down
2 changes: 1 addition & 1 deletion superset/charts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def data(self) -> Response:
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"))
Expand Down

0 comments on commit 6e8d360

Please sign in to comment.