Skip to content

Commit

Permalink
fix(dashboard): Incorrect scopes of cross filters
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Jul 31, 2022
1 parent 5ae0e83 commit a6fc485
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions superset-frontend/src/dashboard/actions/hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,25 @@ export const hydrateDashboard =
if (!metadata.chart_configuration) {
metadata.chart_configuration = {};
}
if (behaviors.includes(Behavior.INTERACTIVE_CHART)) {
if (!metadata.chart_configuration[chartId]) {
metadata.chart_configuration[chartId] = {
id: chartId,
crossFilters: {
scope: {
rootPath: [DASHBOARD_ROOT_ID],
excluded: [chartId], // By default it doesn't affects itself
},
},
};
}
metadata.chart_configuration[chartId].crossFilters.chartsInScope =
getChartIdsInFilterScope(
metadata.chart_configuration[chartId].crossFilters.scope,
chartQueries,
dashboardLayout.present,
);
}
if (
behaviors.includes(Behavior.INTERACTIVE_CHART) &&
!metadata.chart_configuration[chartId]
Expand All @@ -348,21 +367,9 @@ export const hydrateDashboard =
rootPath: [DASHBOARD_ROOT_ID],
excluded: [chartId], // By default it doesn't affects itself
},
chartsInScope: Array.from(sliceIds),
},
};
}
if (
behaviors.includes(Behavior.INTERACTIVE_CHART) &&
!metadata.chart_configuration[chartId].crossFilters?.chartsInScope
) {
metadata.chart_configuration[chartId].crossFilters.chartsInScope =
getChartIdsInFilterScope(
metadata.chart_configuration[chartId].crossFilters.scope,
charts,
dashboardLayout.present,
);
}
});
}

Expand Down

0 comments on commit a6fc485

Please sign in to comment.