From 67be8daa42bdd6e5523082508c07b8a0f2585a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Csneha122=E2=80=9D?= <“sneha@appsmith.com”> Date: Fri, 23 Jun 2023 10:35:51 +0530 Subject: [PATCH] fix: forking reconnect modal issue fixed (#24752) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes forking related issues introduced in plugins like Google Sheets, Amazon S3, DynamoDB, MongoDB etc. Fixes #24566 > if no issue exists, please create an issue and ask the maintainers about this first > > > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > - Bug fix (non-breaking change which fixes an issue) > > > > > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] Jest - [ ] Cypress > > > Add Testsmith test cases links that relate to this PR > > > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: “sneha122” <“sneha@appsmith.com”> --- app/client/src/ce/sagas/ApplicationSagas.tsx | 6 ++++-- app/client/src/sagas/DatasourcesSagas.ts | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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; }