diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index 2e0ca3045..7453a6a34 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -539,20 +539,10 @@ const DatabaseModal: FunctionComponent = ({ const dbToUpdate = JSON.parse(JSON.stringify(update)); if (dbToUpdate.configuration_method === CONFIGURATION_METHOD.DYNAMIC_FORM) { - // Validate DB before saving - await getValidation(dbToUpdate, true); - if (validationErrors && !isEmpty(validationErrors)) { - return; - } - if (dbToUpdate?.parameters?.query) { // convert query params into dictionary - dbToUpdate.parameters.query = JSON.parse( - `{"${decodeURI((dbToUpdate?.parameters?.query as string) || '') - .replace(/"/g, '\\"') - .replace(/&/g, '","') - .replace(/=/g, '":"')}"}`, - ); + const urlParams = new URLSearchParams(dbToUpdate?.parameters?.query); + dbToUpdate.parameters.query = Object.fromEntries(urlParams); } else if ( dbToUpdate?.parameters?.query === '' && 'query' in dbModel.parameters.properties @@ -560,6 +550,12 @@ const DatabaseModal: FunctionComponent = ({ dbToUpdate.parameters.query = {}; } + // Validate DB before saving + await getValidation(dbToUpdate, true); + if (validationErrors && !isEmpty(validationErrors)) { + return; + } + const engine = dbToUpdate.backend || dbToUpdate.engine; if (engine === 'bigquery' && dbToUpdate.parameters?.credentials_info) { // wrap encrypted_extra in credentials_info only for BigQuery diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json index cc79cf31e..ed0ce5349 100644 --- a/superset-frontend/tsconfig.json +++ b/superset-frontend/tsconfig.json @@ -7,7 +7,7 @@ "forceConsistentCasingInFileNames": true, "importHelpers": false, "jsx": "preserve", - "lib": ["dom", "esnext"], + "lib": ["dom", "dom.iterable", "esnext"], "module": "esnext", "moduleResolution": "node", "noImplicitAny": true,