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

fix: can not correctly set force in store #19932

Merged
merged 2 commits into from
May 3, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions superset-frontend/src/explore/actions/exploreActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -181,6 +189,7 @@ export const exploreActions = {
sliceUpdated,
setTimeFormattedColumn,
unsetTimeFormattedColumn,
setForceQuery,
};

export type ExploreActions = typeof exploreActions;
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const createProps = () => ({
sort_y_axis: 'alpha_asc',
extra_form_data: {},
},
queryForce: false,
chartStatus: 'rendered',
onCollapseChange: jest.fn(),
queriesResponse: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,15 @@ const TableControls = ({

export const DataTablesPane = ({
queryFormData,
queryForce,
onCollapseChange,
chartStatus,
ownState,
errorMessage,
queriesResponse,
}: {
queryFormData: Record<string, any>;
queryForce: boolean;
chartStatus: string;
ownState?: JsonObject;
onCollapseChange: (isOpen: boolean) => void;
Expand Down Expand Up @@ -271,6 +273,7 @@ export const DataTablesPane = ({
}));
return getChartDataRequest({
formData: queryFormData,
force: queryForce,
resultFormat: 'json',
resultType,
ownState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const ExploreChartPanel = ({
}, []);

const refreshCachedQuery = useCallback(() => {
actions.setForceQuery(true);
actions.postChartFormData(
formData,
true,
Expand Down Expand Up @@ -387,6 +388,7 @@ const ExploreChartPanel = ({
<DataTablesPane
ownState={ownState}
queryFormData={queryFormData}
queryForce={force}
onCollapseChange={onCollapseChange}
chartStatus={chart.chartStatus}
errorMessage={errorMessage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions superset-frontend/src/explore/reducers/exploreReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down