diff --git a/app/client/src/components/editorComponents/form/fields/DatasourcesField.tsx b/app/client/src/components/editorComponents/form/fields/DatasourcesField.tsx index a641f58f0c..2ea21e44c7 100644 --- a/app/client/src/components/editorComponents/form/fields/DatasourcesField.tsx +++ b/app/client/src/components/editorComponents/form/fields/DatasourcesField.tsx @@ -106,7 +106,7 @@ const DatasourcesField = ( } const DropdownIndicator = (props: any) => { - if (props.hasValue) return null; + if (props.hasValue || !props.selectProps.inputValue) return null; const MenuContainer = ( @@ -198,7 +198,7 @@ const DatasourcesField = ( const baseUrl = url.origin; datasourcePayload = { - name: baseUrl, + name: baseUrl || "DEFAULT_REST_DATASOURCE", datasourceConfiguration: { url: baseUrl, }, @@ -206,7 +206,7 @@ const DatasourcesField = ( pathPayload = path + params; } catch (e) { datasourcePayload = { - name: value, + name: value || "DEFAULT_REST_DATASOURCE", datasourceConfiguration: { url: value, }, diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts index 966da486df..9fc2a23183 100644 --- a/app/client/src/sagas/DatasourcesSagas.ts +++ b/app/client/src/sagas/DatasourcesSagas.ts @@ -368,7 +368,8 @@ function* storeAsDatasourceSaga() { const { values } = yield select(getFormData, API_EDITOR_FORM_NAME); const applicationId = yield select(getCurrentApplicationId); const pageId = yield select(getCurrentPageId); - const datasource = _.get(values, "datasource"); + let datasource = _.get(values, "datasource"); + datasource = _.omit(datasource, ["name"]); history.push(DATA_SOURCES_EDITOR_URL(applicationId, pageId));