graceguo-supercat closed pull request #3893: Only refreshing non instant filters on apply URL: https://github.com/apache/incubator-superset/pull/3893
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/superset/assets/javascripts/dashboard/reducers.js b/superset/assets/javascripts/dashboard/reducers.js index 8d7b7f483d..5001fd13d4 100644 --- a/superset/assets/javascripts/dashboard/reducers.js +++ b/superset/assets/javascripts/dashboard/reducers.js @@ -134,9 +134,9 @@ const dashboard = function (state = {}, action) { // d3.merge pass in array of arrays while some value form filter components // from and to filter box require string to be process and return } else if (state.filters[sliceId][col] instanceof Array) { - newFilter = d3.merge([state.filters[sliceId][col], vals]); + newFilter[col] = d3.merge([state.filters[sliceId][col], vals]); } else { - newFilter = d3.merge([[state.filters[sliceId][col]], vals])[0] || ''; + newFilter[col] = d3.merge([[state.filters[sliceId][col]], vals])[0] || ''; } filters = { ...state.filters, [sliceId]: newFilter }; } diff --git a/superset/assets/visualizations/filter_box.jsx b/superset/assets/visualizations/filter_box.jsx index bdcf978d3d..7653ec2cc2 100644 --- a/superset/assets/visualizations/filter_box.jsx +++ b/superset/assets/visualizations/filter_box.jsx @@ -72,7 +72,14 @@ class FilterBox extends React.Component { return control; } clickApply() { - this.props.onChange(Object.keys(this.state.selectedValues)[0], [], true, true); + const { selectedValues } = this.state; + Object.keys(selectedValues).forEach((fltr, i, arr) => { + let refresh = false; + if (i === arr.length - 1) { + refresh = true; + } + this.props.onChange(fltr, selectedValues[fltr], false, refresh); + }); this.setState({ hasChanged: false }); } changeFilter(filter, options) { @@ -90,7 +97,9 @@ class FilterBox extends React.Component { const selectedValues = Object.assign({}, this.state.selectedValues); selectedValues[fltr] = vals; this.setState({ selectedValues, hasChanged: true }); - this.props.onChange(fltr, vals, false, this.props.instantFiltering); + if (this.props.instantFiltering) { + this.props.onChange(fltr, vals, false, true); + } } render() { let dateFilter; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services