From c02543b61fe8ab3cca50b4b74477324c1cc1cbd9 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Tue, 1 Mar 2022 15:19:06 +0200 Subject: [PATCH] use omitBy --- superset-frontend/src/explore/exploreUtils/formData.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/explore/exploreUtils/formData.ts b/superset-frontend/src/explore/exploreUtils/formData.ts index 439ed6df7a78..0fa0b4a6caa3 100644 --- a/superset-frontend/src/explore/exploreUtils/formData.ts +++ b/superset-frontend/src/explore/exploreUtils/formData.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import { omitBy } from 'lodash'; import { SupersetClient, JsonObject } from '@superset-ui/core'; type Payload = { @@ -27,9 +28,7 @@ type Payload = { const TEMPORARY_CONTROLS = new Set(['url_params']); export const sanitizeFormData = (formData: JsonObject): JsonObject => - Object.keys(formData) - .filter(key => !TEMPORARY_CONTROLS.has(key)) - .reduce((cum, key) => ({ ...cum, [key]: formData[key] }), {}); + omitBy(formData, key => TEMPORARY_CONTROLS.has(key)); const assembleEndpoint = (key?: string, tabId?: string) => { let endpoint = 'api/v1/explore/form_data';