Fix running query on every change in chart controls (#12361)

This commit is contained in:
Kamil Gabryjelski
2021-01-08 21:56:45 +01:00
committed by GitHub
parent 7c8ead85c1
commit 1d2789944c

View File

@@ -265,7 +265,6 @@ function ExploreViewContainer(props) {
}
}, [isDynamicPluginLoading]);
// effect to run when controls change
useEffect(() => {
const hasError = Object.values(props.controls).some(
control =>
@@ -274,7 +273,10 @@ function ExploreViewContainer(props) {
if (!hasError) {
props.actions.triggerQuery(true, props.chart.id);
}
}, []);
// effect to run when controls change
useEffect(() => {
if (previousControls) {
if (props.controls.viz_type.value !== previousControls.viz_type.value) {
props.actions.resetControls();