diff --git a/superset-frontend/src/explore/actions/exploreActions.ts b/superset-frontend/src/explore/actions/exploreActions.ts index 395df7aa13c0..61e73e8cc485 100644 --- a/superset-frontend/src/explore/actions/exploreActions.ts +++ b/superset-frontend/src/explore/actions/exploreActions.ts @@ -164,6 +164,14 @@ export function unsetTimeFormattedColumn( }; } +export const SET_FORCE_QUERY = 'SET_FORCE_QUERY'; +export function setForceQuery(force: boolean) { + return { + type: SET_FORCE_QUERY, + force, + }; +} + export const exploreActions = { ...toastActions, setDatasourceType, @@ -181,6 +189,7 @@ export const exploreActions = { sliceUpdated, setTimeFormattedColumn, unsetTimeFormattedColumn, + setForceQuery, }; export type ExploreActions = typeof exploreActions; diff --git a/superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.test.tsx b/superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.test.tsx index 04869f5f1002..b2b3f168c910 100644 --- a/superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.test.tsx +++ b/superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.test.tsx @@ -54,6 +54,7 @@ const createProps = () => ({ sort_y_axis: 'alpha_asc', extra_form_data: {}, }, + queryForce: false, chartStatus: 'rendered', onCollapseChange: jest.fn(), queriesResponse: [ diff --git a/superset-frontend/src/explore/components/DataTablesPane/index.tsx b/superset-frontend/src/explore/components/DataTablesPane/index.tsx index a41af3626f1e..22f39328013c 100644 --- a/superset-frontend/src/explore/components/DataTablesPane/index.tsx +++ b/superset-frontend/src/explore/components/DataTablesPane/index.tsx @@ -233,6 +233,7 @@ const TableControls = ({ export const DataTablesPane = ({ queryFormData, + queryForce, onCollapseChange, chartStatus, ownState, @@ -240,6 +241,7 @@ export const DataTablesPane = ({ queriesResponse, }: { queryFormData: Record; + queryForce: boolean; chartStatus: string; ownState?: JsonObject; onCollapseChange: (isOpen: boolean) => void; @@ -271,6 +273,7 @@ export const DataTablesPane = ({ })); return getChartDataRequest({ formData: queryFormData, + force: queryForce, resultFormat: 'json', resultType, ownState, diff --git a/superset-frontend/src/explore/components/ExploreChartPanel.jsx b/superset-frontend/src/explore/components/ExploreChartPanel.jsx index 5cd818f52ee8..49ed20848d68 100644 --- a/superset-frontend/src/explore/components/ExploreChartPanel.jsx +++ b/superset-frontend/src/explore/components/ExploreChartPanel.jsx @@ -189,6 +189,7 @@ const ExploreChartPanel = ({ }, []); const refreshCachedQuery = useCallback(() => { + actions.setForceQuery(true); actions.postChartFormData( formData, true, @@ -387,6 +388,7 @@ const ExploreChartPanel = ({ { + props.actions.setForceQuery(false); props.actions.triggerQuery(true, props.chart.id); addHistory(); setLastQueriedControls(props.controls); diff --git a/superset-frontend/src/explore/reducers/exploreReducer.js b/superset-frontend/src/explore/reducers/exploreReducer.js index 96fa18be53bb..4025f726cd72 100644 --- a/superset-frontend/src/explore/reducers/exploreReducer.js +++ b/superset-frontend/src/explore/reducers/exploreReducer.js @@ -273,6 +273,12 @@ export default function exploreReducer(state = {}, action) { ); return { ...state, timeFormattedColumns: newTimeFormattedColumns }; }, + [actions.SET_FORCE_QUERY]() { + return { + ...state, + force: action.force, + }; + }, }; if (action.type in actionHandlers) {