Skip to content
Snippets Groups Projects
Unverified Commit 5115001f authored by metabase-bot[bot]'s avatar metabase-bot[bot] Committed by GitHub
Browse files

Fix x-ray dashboards run some queries twice on load (#40844) (#40853)


* Fix parameter values comparison in x-rays

* Skip rerun when `parameterValues` are not initialized

* Remove not used code

Co-authored-by: default avatarAnton Kulyk <kuliks.anton@gmail.com>
parent e6cab609
No related branches found
No related tags found
No related merge requests found
......@@ -91,16 +91,24 @@ export const DashboardData = ComposedComponent =>
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.dashboardId !== this.props.dashboardId) {
this.load(nextProps);
} else if (
return;
}
// First time componentWillReceiveProps is called,
// parameterValues are an empty object, and nextProps.parameterValues have all value set to null
// DashboardsData is only used for x-rays, and we should better switch them to the same logic as other dashboards
if (
!_.isEmpty(this.props.parameterValues) &&
!_.isEqual(this.props.parameterValues, nextProps.parameterValues)
) {
this.props.fetchDashboardCardData({
reload: false,
clearCache: true,
});
} else if (
!_.isEqual(nextProps.selectedTabId, this.props.selectedTabId)
) {
return;
}
if (!_.isEqual(nextProps.selectedTabId, this.props.selectedTabId)) {
this.props.fetchDashboardCardData();
this.props.fetchDashboardCardMetadata();
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment