Skip to content
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

[dashboard bug]Instant control should take effect instantly #3890

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion superset/assets/javascripts/chart/ChartContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ function mapStateToProps({ charts }, ownProps) {
chartUpdateEndTime: chart.chartUpdateEndTime,
chartUpdateStartTime: chart.chartUpdateStartTime,
latestQueryFormData: chart.latestQueryFormData,
lastRendered: chart.lastRendered,
queryResponse: chart.queryResponse,
queryRequest: chart.queryRequest,
triggerQuery: chart.triggerQuery,
triggerRender: chart.triggerRender,
};
}

Expand Down
2 changes: 2 additions & 0 deletions superset/assets/javascripts/chart/chartReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const chartPropType = {
chartUpdateEndTime: PropTypes.number,
chartUpdateStartTime: PropTypes.number,
latestQueryFormData: PropTypes.object,
queryRequest: PropTypes.object,
queryResponse: PropTypes.object,
triggerQuery: PropTypes.bool,
lastRendered: PropTypes.number,
Expand All @@ -24,6 +25,7 @@ export const chart = {
chartUpdateEndTime: null,
chartUpdateStartTime: now(),
latestQueryFormData: null,
queryRequest: null,
queryResponse: null,
triggerQuery: true,
lastRendered: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ControlPanelsContainer from './ControlPanelsContainer';
import SaveModal from './SaveModal';
import QueryAndSaveBtns from './QueryAndSaveBtns';
import { getExploreUrl } from '../exploreUtils';
import { areObjectsEqual } from '../../reduxUtils';
import { getFormDataFromControls } from '../stores/store';
import { chartPropType } from '../../chart/chartReducer';
import * as exploreActions from '../actions/exploreActions';
Expand Down Expand Up @@ -50,6 +51,11 @@ class ExploreViewContainer extends React.Component {
if (np.controls.datasource.value !== this.props.controls.datasource.value) {
this.props.actions.fetchDatasourceMetadata(np.form_data.datasource, true);
}
// if any control value changed and it's an instant control
if (Object.keys(np.controls).some(key => (np.controls[key].renderTrigger &&
!areObjectsEqual(np.controls[key].value, this.props.controls[key].value)))) {
this.props.actions.renderTriggered(new Date().getTime(), this.props.chart.chartKey);
}
}

componentDidUpdate() {
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/javascripts/explore/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ const initState = {
[chartKey]: {
chartKey,
chartAlert: null,
chartStatus: null,
chartStatus: 'loading',
chartUpdateEndTime: null,
chartUpdateStartTime: now(),
latestQueryFormData: getFormDataFromControls(controls),
queryRequest: null,
queryResponse: null,
triggerQuery: true,
triggerRender: false,
lastRendered: 0,
},
},
saveModal: {
Expand Down