Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: chart disappears in standalone slice when resizing #12606

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand it is for consistency, but memorization is probably not needed here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendering a single <div> element should be fairly efficient.

}

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