fix(dashboard): incorrect chart error with slow dataset api request (#18852)
* fix(dashboard): incorrect chart error with slow datasource api request * update comments * Add key to styled loading component
This commit is contained in:
parent
2c86d1a2b7
commit
cdd4fa58d0
|
|
@ -208,6 +208,7 @@ class Chart extends React.PureComponent {
|
|||
) {
|
||||
return (
|
||||
<Styles
|
||||
key={chartId}
|
||||
data-ui-anchor="chart"
|
||||
className="chart-container"
|
||||
data-test="chart-container"
|
||||
|
|
@ -220,6 +221,7 @@ class Chart extends React.PureComponent {
|
|||
|
||||
return (
|
||||
<ChartErrorMessage
|
||||
key={chartId}
|
||||
chartId={chartId}
|
||||
error={error}
|
||||
subtitle={message}
|
||||
|
|
|
|||
|
|
@ -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: '',
|
||||
|
|
|
|||
Loading…
Reference in New Issue