Skip to content

Commit

Permalink
fix(dashboard): incorrect chart error with slow dataset api request (#…
Browse files Browse the repository at this point in the history
…18852)

* fix(dashboard): incorrect chart error with slow datasource api request

* update comments

* Add key to styled loading component
  • Loading branch information
ktmud authored Feb 23, 2022
1 parent 2c86d1a commit cdd4fa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions superset-frontend/src/chart/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class Chart extends React.PureComponent {
) {
return (
<Styles
key={chartId}
data-ui-anchor="chart"
className="chart-container"
data-test="chart-container"
Expand All @@ -220,6 +221,7 @@ class Chart extends React.PureComponent {

return (
<ChartErrorMessage
key={chartId}
chartId={chartId}
error={error}
subtitle={message}
Expand Down
7 changes: 4 additions & 3 deletions superset-frontend/src/chart/chartReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ export default function chartReducer(
return Object.fromEntries(
Object.entries(charts).map(([chartId, chart]) => [
chartId,
// if render has failed, clear error message,
// which will trigger a re-render
chart.chartStatus === 'failed'
// some charts may not have properly handled missing datasource,
// causing a JS error, so we reset error message and try to re-render
// the chart once the datasource is fully loaded
chart.chartStatus === 'failed' && chart.chartStackTrace
? {
...chart,
chartStatus: '',
Expand Down

0 comments on commit cdd4fa5

Please sign in to comment.