diff --git a/app/client/src/ce/sagas/ApplicationSagas.tsx b/app/client/src/ce/sagas/ApplicationSagas.tsx index 5354591383..e5c9d5c918 100644 --- a/app/client/src/ce/sagas/ApplicationSagas.tsx +++ b/app/client/src/ce/sagas/ApplicationSagas.tsx @@ -102,7 +102,7 @@ import { GUIDED_TOUR_STEPS } from "pages/Editor/GuidedTour/constants"; import { builderURL, viewerURL } from "RouteBuilder"; import { getDefaultPageId as selectDefaultPageId } from "sagas/selectors"; import PageApi from "api/PageApi"; -import { identity, merge, pickBy } from "lodash"; +import { identity, isEmpty, merge, pickBy } from "lodash"; import { checkAndGetPluginFormConfigsSaga } from "sagas/PluginSagas"; import { getPageList, getPluginForm } from "selectors/entitiesSelector"; import { getConfigInitialValues } from "components/formControls/utils"; @@ -851,7 +851,9 @@ export function* fetchUnconfiguredDatasourceList( } export function* initializeDatasourceWithDefaultValues(datasource: Datasource) { - if (!datasource.datasourceConfiguration) { + // Added isEmpty instead of ! condition as ! does not account for + // datasourceConfiguration being empty + if (isEmpty(datasource.datasourceConfiguration)) { yield call(checkAndGetPluginFormConfigsSaga, datasource.pluginId); const formConfig: Record[] = yield select( getPluginForm, diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts index 1f360eeb11..b7fa16c429 100644 --- a/app/client/src/sagas/DatasourcesSagas.ts +++ b/app/client/src/sagas/DatasourcesSagas.ts @@ -416,9 +416,9 @@ function* updateDatasourceSaga( // We do not want to set isConfigured to true immediately on save // instead we want to wait for authorisation as well as file selection to be complete if (isGoogleSheetPluginDS(pluginPackageName)) { - const scopeString: string = ( - datasourcePayload?.datasourceConfiguration?.authentication as any - )?.scopeString; + const scopeString: string = + (datasourcePayload?.datasourceConfiguration?.authentication as any) + ?.scopeString || ""; if (scopeString.includes(GOOGLE_SHEET_SPECIFIC_SHEETS_SCOPE)) { datasourcePayload.isConfigured = false; }