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

chore: Pass the dashboard id when requesting filter values #25025

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
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
Loading