mirror of https://github.com/apache/superset.git
fix: can not correctly set force in store (#19932)
* fix: can not correctly set force in store * fix ut
This commit is contained in:
parent
7f8279b4b3
commit
24e4ab6a1f
|
@ -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;
|
||||
|
|
|
@ -54,6 +54,7 @@ const createProps = () => ({
|
|||
sort_y_axis: 'alpha_asc',
|
||||
extra_form_data: {},
|
||||
},
|
||||
queryForce: false,
|
||||
chartStatus: 'rendered',
|
||||
onCollapseChange: jest.fn(),
|
||||
queriesResponse: [
|
||||
|
|
|
@ -233,6 +233,7 @@ const TableControls = ({
|
|||
|
||||
export const DataTablesPane = ({
|
||||
queryFormData,
|
||||
queryForce,
|
||||
onCollapseChange,
|
||||
chartStatus,
|
||||
ownState,
|
||||
|
@ -240,6 +241,7 @@ export const DataTablesPane = ({
|
|||
queriesResponse,
|
||||
}: {
|
||||
queryFormData: Record<string, any>;
|
||||
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,
|
||||
|
|
|
@ -189,6 +189,7 @@ const ExploreChartPanel = ({
|
|||
}, []);
|
||||
|
||||
const refreshCachedQuery = useCallback(() => {
|
||||
actions.setForceQuery(true);
|
||||
actions.postChartFormData(
|
||||
formData,
|
||||
true,
|
||||
|
@ -387,6 +388,7 @@ const ExploreChartPanel = ({
|
|||
<DataTablesPane
|
||||
ownState={ownState}
|
||||
queryFormData={queryFormData}
|
||||
queryForce={force}
|
||||
onCollapseChange={onCollapseChange}
|
||||
chartStatus={chart.chartStatus}
|
||||
errorMessage={errorMessage}
|
||||
|
|
|
@ -285,6 +285,7 @@ function ExploreViewContainer(props) {
|
|||
}, [props.actions, props.chart.id, props.timeout]);
|
||||
|
||||
const onQuery = useCallback(() => {
|
||||
props.actions.setForceQuery(false);
|
||||
props.actions.triggerQuery(true, props.chart.id);
|
||||
addHistory();
|
||||
setLastQueriedControls(props.controls);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue