You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/28 14:01:12 UTC

[GitHub] [superset] villebro commented on a diff in pull request #22168: feat(native-filters): Adhoc dashboard native filters

villebro commented on code in PR #22168:
URL: https://github.com/apache/superset/pull/22168#discussion_r1033560751


##########
superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx:
##########
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-disable no-param-reassign */
+import {
+  DataMask,
+  ensureIsArray,
+  ExtraFormData,
+  JsonObject,
+  JsonResponse,
+  smartDateDetailedFormatter,
+  SupersetApiError,
+  SupersetClient,
+  t,
+} from '@superset-ui/core';
+import React, { useCallback, useEffect, useState, useMemo } from 'react';
+import { useImmerReducer } from 'use-immer';
+import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
+// eslint-disable-next-line import/no-unresolved
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+// eslint-disable-next-line import/no-unresolved
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+// eslint-disable-next-line import/no-unresolved
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+// eslint-disable-next-line import/no-unresolved
+import { useChangeEffect } from 'src/hooks/useChangeEffect';
+import { PluginFilterAdhocProps } from './types';
+import {
+  StyledFormItem,
+  FilterPluginStyle,
+  StatusMessage,
+  ControlContainer,
+} from '../common';
+import { getDataRecordFormatter, getAdhocExtraFormData } from '../../utils';
+
+type DataMaskAction =
+  | { type: 'ownState'; ownState: JsonObject }
+  | {
+      type: 'filterState';
+      __cache: JsonObject;
+      extraFormData: ExtraFormData;
+      filterState: {
+        label?: string;
+        filters?: AdhocFilter[];
+        value: AdhocFilter[];
+      };
+    };
+
+function reducer(
+  draft: DataMask & { __cache?: JsonObject },
+  action: DataMaskAction,
+) {
+  switch (action.type) {
+    case 'ownState':
+      draft.ownState = {
+        ...draft.ownState,
+        ...action.ownState,
+      };
+      return draft;
+    case 'filterState':
+      draft.extraFormData = action.extraFormData;
+      // eslint-disable-next-line no-underscore-dangle
+      draft.__cache = action.__cache;
+      draft.filterState = { ...draft.filterState, ...action.filterState };
+      return draft;
+    default:
+      return draft;
+  }
+}
+
+export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
+  const {
+    filterState,
+    formData,
+    height,
+    width,
+    setDataMask,
+    setFocusedFilter,
+    unsetFocusedFilter,
+    appSection,
+  } = props;
+  const { enableEmptyFilter, inverseSelection, defaultToFirstItem } = formData;

Review Comment:
   I assume this is a leftover? This should also simplify downstream logic
   ```suggestion
     const { enableEmptyFilter } = formData;
   ```



##########
superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx:
##########
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-disable no-param-reassign */
+import {
+  DataMask,
+  ensureIsArray,
+  ExtraFormData,
+  JsonObject,
+  JsonResponse,
+  smartDateDetailedFormatter,
+  SupersetApiError,
+  SupersetClient,
+  t,
+} from '@superset-ui/core';
+import React, { useCallback, useEffect, useState, useMemo } from 'react';
+import { useImmerReducer } from 'use-immer';
+import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
+// eslint-disable-next-line import/no-unresolved
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+// eslint-disable-next-line import/no-unresolved
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+// eslint-disable-next-line import/no-unresolved
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+// eslint-disable-next-line import/no-unresolved
+import { useChangeEffect } from 'src/hooks/useChangeEffect';
+import { PluginFilterAdhocProps } from './types';
+import {
+  StyledFormItem,
+  FilterPluginStyle,
+  StatusMessage,
+  ControlContainer,
+} from '../common';
+import { getDataRecordFormatter, getAdhocExtraFormData } from '../../utils';
+
+type DataMaskAction =
+  | { type: 'ownState'; ownState: JsonObject }
+  | {
+      type: 'filterState';
+      __cache: JsonObject;
+      extraFormData: ExtraFormData;
+      filterState: {
+        label?: string;
+        filters?: AdhocFilter[];
+        value: AdhocFilter[];
+      };
+    };
+
+function reducer(
+  draft: DataMask & { __cache?: JsonObject },
+  action: DataMaskAction,
+) {
+  switch (action.type) {
+    case 'ownState':
+      draft.ownState = {
+        ...draft.ownState,
+        ...action.ownState,
+      };
+      return draft;
+    case 'filterState':
+      draft.extraFormData = action.extraFormData;
+      // eslint-disable-next-line no-underscore-dangle
+      draft.__cache = action.__cache;
+      draft.filterState = { ...draft.filterState, ...action.filterState };
+      return draft;
+    default:
+      return draft;
+  }
+}
+
+export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
+  const {
+    filterState,
+    formData,
+    height,
+    width,
+    setDataMask,
+    setFocusedFilter,
+    unsetFocusedFilter,
+    appSection,
+  } = props;
+  const { enableEmptyFilter, inverseSelection, defaultToFirstItem } = formData;
+  const datasetId = useMemo(
+    () => formData.datasource.split('_')[0],
+    [formData.datasource],
+  );
+  const [datasetDetails, setDatasetDetails] = useState<Record<string, any>>();
+  const [columns, setColumns] = useState();
+  const [dataMask, dispatchDataMask] = useImmerReducer(reducer, {
+    extraFormData: {},
+    filterState,
+  });
+  const labelFormatter = useMemo(
+    () =>
+      getDataRecordFormatter({
+        timeFormatter: smartDateDetailedFormatter,
+      }),
+    [],
+  );
+
+  const localCache = new Map<string, any>();
+
+  const cachedSupersetGet = cacheWrapper(
+    SupersetClient.get,
+    localCache,
+    ({ endpoint }) => endpoint || '',
+  );
+
+  useChangeEffect(datasetId, () => {
+    if (datasetId) {
+      cachedSupersetGet({
+        endpoint: `/api/v1/dataset/${datasetId}`,
+      })
+        .then((response: JsonResponse) => {
+          const dataset = response.json?.result;
+          // modify the response to fit structure expected by AdhocFilterControl
+          dataset.type = dataset.datasource_type;
+          dataset.filter_select = true;
+          setDatasetDetails(dataset);
+        })
+        .catch((response: SupersetApiError) => {
+          addDangerToast(response.message);
+        });
+    }
+  });
+
+  useChangeEffect(datasetId, () => {
+    if (datasetId != null) {
+      cachedSupersetGet({
+        endpoint: `/api/v1/dataset/${datasetId}`,
+      }).then(
+        ({ json: { result } }) => {
+          setColumns(result.columns);
+        },
+        async badResponse => {
+          const { error, message } = await getClientErrorObject(badResponse);
+          let errorText = message || error || t('An error has occurred');
+          if (message === 'Forbidden') {
+            errorText = t('You do not have permission to edit this dashboard');
+          }
+          addDangerToast(errorText);
+        },
+      );
+    }
+  });
+
+  const labelString: (props: AdhocFilter) => string = (props: AdhocFilter) => {
+    if (ensureIsArray(props.comparator).length >= 2) {
+      return `${props.subject} ${props.operator} (${props.comparator.join(
+        ', ',
+      )})`;
+    }
+    return `${props.subject} ${props.operator} ${props.comparator}`;
+  };

Review Comment:
   Can we DRY this up by reusing the existing pill label formatter function?



##########
superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx:
##########
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-disable no-param-reassign */
+import {
+  DataMask,
+  ensureIsArray,
+  ExtraFormData,
+  JsonObject,
+  JsonResponse,
+  smartDateDetailedFormatter,
+  SupersetApiError,
+  SupersetClient,
+  t,
+} from '@superset-ui/core';
+import React, { useCallback, useEffect, useState, useMemo } from 'react';
+import { useImmerReducer } from 'use-immer';
+import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
+// eslint-disable-next-line import/no-unresolved
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+// eslint-disable-next-line import/no-unresolved
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+// eslint-disable-next-line import/no-unresolved
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+// eslint-disable-next-line import/no-unresolved
+import { useChangeEffect } from 'src/hooks/useChangeEffect';
+import { PluginFilterAdhocProps } from './types';
+import {
+  StyledFormItem,
+  FilterPluginStyle,
+  StatusMessage,
+  ControlContainer,
+} from '../common';
+import { getDataRecordFormatter, getAdhocExtraFormData } from '../../utils';
+
+type DataMaskAction =
+  | { type: 'ownState'; ownState: JsonObject }
+  | {
+      type: 'filterState';
+      __cache: JsonObject;
+      extraFormData: ExtraFormData;
+      filterState: {
+        label?: string;
+        filters?: AdhocFilter[];
+        value: AdhocFilter[];
+      };
+    };
+
+function reducer(
+  draft: DataMask & { __cache?: JsonObject },
+  action: DataMaskAction,
+) {
+  switch (action.type) {
+    case 'ownState':
+      draft.ownState = {
+        ...draft.ownState,
+        ...action.ownState,
+      };
+      return draft;
+    case 'filterState':
+      draft.extraFormData = action.extraFormData;
+      // eslint-disable-next-line no-underscore-dangle
+      draft.__cache = action.__cache;
+      draft.filterState = { ...draft.filterState, ...action.filterState };
+      return draft;
+    default:
+      return draft;
+  }
+}
+
+export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
+  const {
+    filterState,
+    formData,
+    height,
+    width,
+    setDataMask,
+    setFocusedFilter,
+    unsetFocusedFilter,
+    appSection,
+  } = props;
+  const { enableEmptyFilter, inverseSelection, defaultToFirstItem } = formData;
+  const datasetId = useMemo(
+    () => formData.datasource.split('_')[0],
+    [formData.datasource],
+  );
+  const [datasetDetails, setDatasetDetails] = useState<Record<string, any>>();
+  const [columns, setColumns] = useState();
+  const [dataMask, dispatchDataMask] = useImmerReducer(reducer, {
+    extraFormData: {},
+    filterState,
+  });
+  const labelFormatter = useMemo(
+    () =>
+      getDataRecordFormatter({
+        timeFormatter: smartDateDetailedFormatter,
+      }),
+    [],
+  );
+
+  const localCache = new Map<string, any>();
+
+  const cachedSupersetGet = cacheWrapper(
+    SupersetClient.get,
+    localCache,
+    ({ endpoint }) => endpoint || '',
+  );
+
+  useChangeEffect(datasetId, () => {
+    if (datasetId) {
+      cachedSupersetGet({
+        endpoint: `/api/v1/dataset/${datasetId}`,
+      })
+        .then((response: JsonResponse) => {
+          const dataset = response.json?.result;
+          // modify the response to fit structure expected by AdhocFilterControl
+          dataset.type = dataset.datasource_type;
+          dataset.filter_select = true;
+          setDatasetDetails(dataset);
+        })
+        .catch((response: SupersetApiError) => {
+          addDangerToast(response.message);
+        });
+    }
+  });
+
+  useChangeEffect(datasetId, () => {
+    if (datasetId != null) {
+      cachedSupersetGet({
+        endpoint: `/api/v1/dataset/${datasetId}`,
+      }).then(
+        ({ json: { result } }) => {
+          setColumns(result.columns);
+        },
+        async badResponse => {
+          const { error, message } = await getClientErrorObject(badResponse);
+          let errorText = message || error || t('An error has occurred');
+          if (message === 'Forbidden') {
+            errorText = t('You do not have permission to edit this dashboard');

Review Comment:
   Isn't this going to happen if the user doesn't have permission to read the dataset?
   ```suggestion
               errorText = t('You do not have permission to access the dataset');
   ```



##########
superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx:
##########
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-disable no-param-reassign */
+import {
+  DataMask,
+  ensureIsArray,
+  ExtraFormData,
+  JsonObject,
+  JsonResponse,
+  smartDateDetailedFormatter,
+  SupersetApiError,
+  SupersetClient,
+  t,
+} from '@superset-ui/core';
+import React, { useCallback, useEffect, useState, useMemo } from 'react';
+import { useImmerReducer } from 'use-immer';
+import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
+// eslint-disable-next-line import/no-unresolved
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+// eslint-disable-next-line import/no-unresolved
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+// eslint-disable-next-line import/no-unresolved
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+// eslint-disable-next-line import/no-unresolved
+import { useChangeEffect } from 'src/hooks/useChangeEffect';
+import { PluginFilterAdhocProps } from './types';
+import {
+  StyledFormItem,
+  FilterPluginStyle,
+  StatusMessage,
+  ControlContainer,
+} from '../common';
+import { getDataRecordFormatter, getAdhocExtraFormData } from '../../utils';
+
+type DataMaskAction =
+  | { type: 'ownState'; ownState: JsonObject }
+  | {
+      type: 'filterState';
+      __cache: JsonObject;
+      extraFormData: ExtraFormData;
+      filterState: {
+        label?: string;
+        filters?: AdhocFilter[];
+        value: AdhocFilter[];

Review Comment:
   I know this is poorly documented, but the filter indicator shows the filter as being applied as long as `value` is not equal to `null`. So always remember to set `value` to `null` if the filter is unset.



##########
superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx:
##########
@@ -0,0 +1,254 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* eslint-disable no-param-reassign */
+import {
+  DataMask,
+  ensureIsArray,
+  ExtraFormData,
+  JsonObject,
+  JsonResponse,
+  smartDateDetailedFormatter,
+  SupersetApiError,
+  SupersetClient,
+  t,
+} from '@superset-ui/core';
+import React, { useCallback, useEffect, useState, useMemo } from 'react';
+import { useImmerReducer } from 'use-immer';
+import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
+// eslint-disable-next-line import/no-unresolved
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+// eslint-disable-next-line import/no-unresolved
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+// eslint-disable-next-line import/no-unresolved
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+// eslint-disable-next-line import/no-unresolved
+import { useChangeEffect } from 'src/hooks/useChangeEffect';
+import { PluginFilterAdhocProps } from './types';
+import {
+  StyledFormItem,
+  FilterPluginStyle,
+  StatusMessage,
+  ControlContainer,
+} from '../common';
+import { getDataRecordFormatter, getAdhocExtraFormData } from '../../utils';
+
+type DataMaskAction =
+  | { type: 'ownState'; ownState: JsonObject }
+  | {
+      type: 'filterState';
+      __cache: JsonObject;
+      extraFormData: ExtraFormData;
+      filterState: {
+        label?: string;
+        filters?: AdhocFilter[];
+        value: AdhocFilter[];
+      };
+    };
+
+function reducer(
+  draft: DataMask & { __cache?: JsonObject },
+  action: DataMaskAction,
+) {
+  switch (action.type) {
+    case 'ownState':
+      draft.ownState = {
+        ...draft.ownState,
+        ...action.ownState,
+      };
+      return draft;
+    case 'filterState':
+      draft.extraFormData = action.extraFormData;
+      // eslint-disable-next-line no-underscore-dangle
+      draft.__cache = action.__cache;
+      draft.filterState = { ...draft.filterState, ...action.filterState };
+      return draft;
+    default:
+      return draft;
+  }
+}
+
+export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
+  const {
+    filterState,
+    formData,
+    height,
+    width,
+    setDataMask,
+    setFocusedFilter,
+    unsetFocusedFilter,
+    appSection,
+  } = props;
+  const { enableEmptyFilter, inverseSelection, defaultToFirstItem } = formData;
+  const datasetId = useMemo(
+    () => formData.datasource.split('_')[0],
+    [formData.datasource],
+  );
+  const [datasetDetails, setDatasetDetails] = useState<Record<string, any>>();
+  const [columns, setColumns] = useState();
+  const [dataMask, dispatchDataMask] = useImmerReducer(reducer, {
+    extraFormData: {},
+    filterState,
+  });
+  const labelFormatter = useMemo(
+    () =>
+      getDataRecordFormatter({
+        timeFormatter: smartDateDetailedFormatter,
+      }),
+    [],
+  );
+
+  const localCache = new Map<string, any>();
+
+  const cachedSupersetGet = cacheWrapper(
+    SupersetClient.get,
+    localCache,
+    ({ endpoint }) => endpoint || '',
+  );
+
+  useChangeEffect(datasetId, () => {
+    if (datasetId) {
+      cachedSupersetGet({
+        endpoint: `/api/v1/dataset/${datasetId}`,
+      })
+        .then((response: JsonResponse) => {
+          const dataset = response.json?.result;
+          // modify the response to fit structure expected by AdhocFilterControl
+          dataset.type = dataset.datasource_type;
+          dataset.filter_select = true;
+          setDatasetDetails(dataset);
+        })
+        .catch((response: SupersetApiError) => {
+          addDangerToast(response.message);
+        });
+    }
+  });
+
+  useChangeEffect(datasetId, () => {
+    if (datasetId != null) {
+      cachedSupersetGet({
+        endpoint: `/api/v1/dataset/${datasetId}`,
+      }).then(
+        ({ json: { result } }) => {
+          setColumns(result.columns);
+        },
+        async badResponse => {
+          const { error, message } = await getClientErrorObject(badResponse);
+          let errorText = message || error || t('An error has occurred');
+          if (message === 'Forbidden') {
+            errorText = t('You do not have permission to edit this dashboard');
+          }
+          addDangerToast(errorText);
+        },
+      );
+    }
+  });
+
+  const labelString: (props: AdhocFilter) => string = (props: AdhocFilter) => {
+    if (ensureIsArray(props.comparator).length >= 2) {
+      return `${props.subject} ${props.operator} (${props.comparator.join(
+        ', ',
+      )})`;
+    }
+    return `${props.subject} ${props.operator} ${props.comparator}`;
+  };
+
+  const updateDataMask = useCallback(
+    (adhoc_filters: AdhocFilter[]) => {
+      const emptyFilter =
+        enableEmptyFilter && !inverseSelection && !adhoc_filters?.length;
+
+      dispatchDataMask({
+        type: 'filterState',
+        __cache: filterState,
+        extraFormData: getAdhocExtraFormData(
+          adhoc_filters,
+          emptyFilter,
+          inverseSelection,
+        ),
+        filterState: {
+          ...filterState,
+          label: (adhoc_filters || [])
+            .map(f =>
+              f.sqlExpression ? String(f.sqlExpression) : labelString(f),
+            )
+            .join(', '),
+          value: adhoc_filters,

Review Comment:
   So here we should make sure that `value` is set to `null` if it's unset:
   ```suggestion
             value: adhoc_filters?.length ? adhoc_filters | null,
   ```



##########
superset-frontend/src/filters/utils.ts:
##########
@@ -24,8 +24,29 @@ import {
   TimeFormatter,
   ExtraFormData,
 } from '@superset-ui/core';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
 import { FALSE_STRING, NULL_STRING, TRUE_STRING } from 'src/utils/common';
 
+export const getAdhocExtraFormData = (
+  adhoc_filters: AdhocFilter[] = [],
+  emptyFilter = false,
+  inverseSelection = false,

Review Comment:
   I assume this is also a leftover
   ```suggestion
     inverseSelection = false,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org