This is an automated email from the ASF dual-hosted git repository. villebro pushed a commit to branch 1.0 in repository https://gitbox.apache.org/repos/asf/superset.git
commit e2ce27fe46768ed9b92b553710fe13c6fcb955e8 Author: Duy Nguyen Hoang <[email protected]> AuthorDate: Wed Jan 20 02:56:24 2021 +0700 fix: chart disappears in standalone slice (#12606) --- superset-frontend/src/explore/components/ExploreChartPanel.jsx | 7 ++++++- superset/charts/api.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/explore/components/ExploreChartPanel.jsx b/superset-frontend/src/explore/components/ExploreChartPanel.jsx index bc7e5c7..8fed5b6 100644 --- a/superset-frontend/src/explore/components/ExploreChartPanel.jsx +++ b/superset-frontend/src/explore/components/ExploreChartPanel.jsx @@ -205,6 +205,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'; @@ -212,7 +217,7 @@ const ExploreChartPanel = props => { if (!bodyClasses.includes(standaloneClass)) { document.body.className += ` ${standaloneClass}`; } - return renderChart(); + return standaloneChartBody; } const header = ( diff --git a/superset/charts/api.py b/superset/charts/api.py index cce76da..35cf44c 100644 --- a/superset/charts/api.py +++ b/superset/charts/api.py @@ -542,7 +542,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"))
