diff --git a/airflow/www/static/js/api/index.ts b/airflow/www/static/js/api/index.ts index 94ec52e8630bc..782a4f99a1acd 100644 --- a/airflow/www/static/js/api/index.ts +++ b/airflow/www/static/js/api/index.ts @@ -49,6 +49,13 @@ import useDags from "./useDags"; import useDagRuns from "./useDagRuns"; import useHistoricalMetricsData from "./useHistoricalMetricsData"; +axios.interceptors.request.use((config) => { + config.paramsSerializer = { + indexes: null, + }; + return config; +}); + axios.interceptors.response.use((res: AxiosResponse) => res.data ? camelcaseKeys(res.data, { deep: true }) : res ); diff --git a/airflow/www/static/js/api/useGridData.ts b/airflow/www/static/js/api/useGridData.ts index 502877214c83b..a0cbfd6b76555 100644 --- a/airflow/www/static/js/api/useGridData.ts +++ b/airflow/www/static/js/api/useGridData.ts @@ -105,7 +105,6 @@ const useGridData = () => { }; const response = await axios.get(gridDataUrl, { params, - paramsSerializer: { indexes: null }, }); // turn off auto refresh if there are no active runs if (!areActiveRuns(response.dagRuns)) stopRefresh(); diff --git a/airflow/www/static/js/dag/useFilters.test.tsx b/airflow/www/static/js/dag/useFilters.test.tsx index 72e1b42543e44..87f50b5112217 100644 --- a/airflow/www/static/js/dag/useFilters.test.tsx +++ b/airflow/www/static/js/dag/useFilters.test.tsx @@ -67,8 +67,8 @@ describe("Test useFilters hook", () => { expect(baseDate).toBe(date.toISOString()); expect(numRuns).toBe(global.defaultDagRunDisplayNumber.toString()); - expect(runType).toBeNull(); - expect(runState).toBeNull(); + expect(runType).toEqual([]); + expect(runState).toEqual([]); expect(root).toBeUndefined(); expect(filterUpstream).toBeUndefined(); expect(filterDownstream).toBeUndefined(); @@ -118,7 +118,7 @@ describe("Test useFilters hook", () => { ); }); - expect(result.current.filters[paramName]).toBe(paramValue); + expect(result.current.filters[paramName]).toEqual(paramValue); // clearFilters await act(async () => { @@ -132,7 +132,7 @@ describe("Test useFilters hook", () => { global.defaultDagRunDisplayNumber.toString() ); } else { - expect(result.current.filters[paramName]).toBeNull(); + expect(result.current.filters[paramName]).toEqual([]); } });