Skip to content

Commit

Permalink
chore: Pass the dashboard id when requesting filter values (#25025)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Aug 18, 2023
1 parent b428b06 commit 52c7186
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion superset-frontend/src/components/Chart/chartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export async function getChartDataRequest({
credentials: 'include',
};
}

const [useLegacyApi, parseMethod] = getQuerySettings(formData);
if (useLegacyApi) {
return legacyChartDataRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ const FilterValue: React.FC<FilterControlProps> = ({
const dependencies = useFilterDependencies(id, dataMaskSelected);
const shouldRefresh = useShouldFilterRefresh();
const [state, setState] = useState<ChartDataResponseResult[]>([]);
const dashboardId = useSelector<RootState, number>(
state => state.dashboardInfo.id,
);
const [error, setError] = useState<ClientErrorObject>();
const [formData, setFormData] = useState<Partial<QueryFormData>>({
inView: false,
Expand Down Expand Up @@ -146,6 +149,7 @@ const FilterValue: React.FC<FilterControlProps> = ({
groupby,
adhoc_filters,
time_range,
dashboardId,
});
const filterOwnState = filter.dataMask?.ownState || {};
// TODO: We should try to improve our useEffect hooks to depend more on
Expand All @@ -170,7 +174,6 @@ const FilterValue: React.FC<FilterControlProps> = ({
getChartDataRequest({
formData: newFormData,
force: false,
requestParams: { dashboardId: 0 },
ownState: filterOwnState,
})
.then(({ response, json }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ const FiltersConfigForm = (
const [activeTabKey, setActiveTabKey] = useState<string>(
FilterTabs.configuration.key,
);

const dashboardId = useSelector<RootState, number>(
state => state.dashboardInfo.id,
);
const [undoFormValues, setUndoFormValues] = useState<Record<
string,
any
Expand Down Expand Up @@ -479,6 +481,7 @@ const FiltersConfigForm = (
}
const formData = getFormData({
datasetId: formFilter?.dataset?.value,
dashboardId,
groupby: formFilter?.column,
...formFilter,
});
Expand All @@ -492,7 +495,6 @@ const FiltersConfigForm = (
getChartDataRequest({
formData,
force,
requestParams: { dashboardId: 0 },
})
.then(({ response, json }) => {
if (isFeatureEnabled(FeatureFlag.GLOBAL_ASYNC_QUERIES)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export const getFormData = ({
time_range,
granularity_sqla,
type,
dashboardId,
}: Partial<Filter> & {
dashboardId: number;
datasetId?: number;
dependencies?: object;
groupby?: string;
Expand Down Expand Up @@ -91,6 +93,7 @@ export const getFormData = ({
inView: true,
viz_type: filterType,
type,
dashboardId,
};
};

Expand Down

0 comments on commit 52c7186

Please sign in to comment.