-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Blank Charts while loading dashboard #29283
Comments
Hey @hk-the-analyst! 👋 I'm here to help you with this bug. I'm a bot that can assist you with solving bugs, answering questions, and becoming a contributor. To address the issue where dashboards with multiple charts initially display blank charts that only show values after a forced refresh or right-clicking on the chart, you can follow these steps:
Here is an example of how you can update the class Chart extends React.Component {
constructor(props) {
super(props);
this.state = {
width: props.width,
height: props.height,
descriptionHeight: 0,
};
this.resize = debounce(this.resize.bind(this), RESIZE_TIMEOUT);
}
componentDidMount() {
if (this.props.isExpanded) {
const descriptionHeight = this.getDescriptionHeight();
this.setState({ descriptionHeight });
}
this.resize(); // Ensure resize is called when the component is first mounted
}
componentDidUpdate(prevProps) {
if (this.props.isExpanded !== prevProps.isExpanded) {
const descriptionHeight = this.getDescriptionHeight();
this.setState({ descriptionHeight });
}
if (this.props.isComponentVisible && !prevProps.isComponentVisible) {
this.resize(); // Ensure resize is called when the component becomes visible
}
}
// ... rest of the code remains unchanged
}
Here is an example of how to use the const refreshCharts = (chartList, force, interval, dashboardId, dispatch) =>
new Promise(resolve => {
dispatch(fetchCharts(chartList, force, interval, dashboardId));
resolve();
});
export const ON_REFRESH = 'ON_REFRESH';
export function onRefresh(
chartList = [],
force = false,
interval = 0,
dashboardId,
) {
return dispatch => {
dispatch({ type: ON_REFRESH });
refreshCharts(chartList, force, interval, dashboardId, dispatch).then(
() => {
dispatch(onRefreshSuccess());
dispatch(onFiltersRefresh());
},
);
};
}
Here is an example of how the export default function chartReducer(
charts: Record<string, ChartState> = {},
action: AnyChartAction,
) {
const actionHandlers: Record<string, ChartActionHandler> = {
[actions.ADD_CHART]() {
return {
...chart,
...action.chart,
};
},
[actions.CHART_UPDATE_SUCCEEDED](state) {
return {
...state,
chartStatus: 'success',
chartAlert: null,
queriesResponse: action.queriesResponse,
chartUpdateEndTime: now(),
};
},
// ... other action handlers
};
if (action.type in actionHandlers) {
return {
...charts,
[action.key]: actionHandlers[action.type](charts[action.key]),
};
}
return charts;
} By implementing these changes, you can ensure that charts are properly rendered and refreshed, addressing the issue of initially blank charts [1][2][3]. |
We are not maintaining code, rather using the docker image for version 3.1.1. |
Bug description
When we are loading dashboards with multiple charts blank charts are shown at first which will show values only when forced refresh or on right-clicking the chart.
How to reproduce the bug
Create a dashboard with multiple charts under multiple tabs
Open the dashboard
Many charts will be blank the first time we are loading the chart
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: