From 094e859973f4b834a2c5a10458bb5e94da1e0bcc Mon Sep 17 00:00:00 2001 From: sneha122 Date: Mon, 16 Oct 2023 11:40:55 +0530 Subject: [PATCH] fix: empty error toast message in CI issue fixed (#28010) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description In CI, we observed that in a couple of cases, when we open application in edit mode, we get a blank toast message or sometimes error toast message which is caused while fetching plugin form configs. This PR identifies and fixes the potential cause of the issue. #### PR fixes following issue(s) Fixes #27489 > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > 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 > > #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? > 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 - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] 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 - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [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/sagas/PluginSagas.ts | 63 +++++++++++++++++------------ 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/app/client/src/sagas/PluginSagas.ts b/app/client/src/sagas/PluginSagas.ts index 73a1b11715..4acf95a355 100644 --- a/app/client/src/sagas/PluginSagas.ts +++ b/app/client/src/sagas/PluginSagas.ts @@ -94,6 +94,7 @@ function* fetchPluginFormConfigsSaga() { for (const pluginId of actionPluginIds) { pluginIdFormsToFetch.add(pluginId); } + log.error("pluginIdFormsToFetch acquired"); const pluginFormData: PluginFormPayload[] = []; const pluginFormResponses: ApiResponse[] = yield all( @@ -106,6 +107,8 @@ function* fetchPluginFormConfigsSaga() { pluginFormData.push(response.data); } + log.error("pluginIdFormsToFetch API completion"); + if (jsPlugin) { pluginIdFormsToFetch.add(jsPlugin.id); } @@ -115,6 +118,8 @@ function* fetchPluginFormConfigsSaga() { const dependencies: FormDependencyConfigs = {}; const datasourceFormButtonConfigs: FormDatasourceButtonConfigs = {}; + log.error("pluginIdFormsToFetch jsPlugin details added"); + Array.from(pluginIdFormsToFetch).forEach((pluginId, index) => { const plugin = plugins.find((plugin) => plugin.id === pluginId); if (plugin && plugin.type === PluginType.JS) { @@ -124,35 +129,40 @@ function* fetchPluginFormConfigsSaga() { dependencies[pluginId] = defaultActionDependenciesConfig[plugin.type]; } else { // Datasource form always use server's copy - formConfigs[pluginId] = pluginFormData[index].form; - // Action editor form if not available use default - if (plugin && !pluginFormData[index].editor) { - editorConfigs[pluginId] = defaultActionEditorConfigs[plugin.type]; - } else { - editorConfigs[pluginId] = pluginFormData[index].editor; - } - // Action settings form if not available use default - if (plugin && !pluginFormData[index].setting) { - settingConfigs[pluginId] = defaultActionSettings[plugin.type]; - } else { - settingConfigs[pluginId] = pluginFormData[index].setting; - } - // Action dependencies config if not available use default - if (plugin && !pluginFormData[index].dependencies) { - dependencies[pluginId] = defaultActionDependenciesConfig[plugin.type]; - } else { - dependencies[pluginId] = pluginFormData[index].dependencies; - } - // Datasource form buttons config if not available use default - if (plugin && !pluginFormData[index].formButton) { - datasourceFormButtonConfigs[pluginId] = - defaultDatasourceFormButtonConfig[plugin.type]; - } else { - datasourceFormButtonConfigs[pluginId] = - pluginFormData[index].formButton; + if (!!pluginFormData[index]) { + formConfigs[pluginId] = pluginFormData[index].form; + // Action editor form if not available use default + if (plugin && !pluginFormData[index].editor) { + editorConfigs[pluginId] = defaultActionEditorConfigs[plugin.type]; + } else { + editorConfigs[pluginId] = pluginFormData[index].editor; + } + // Action settings form if not available use default + if (plugin && !pluginFormData[index].setting) { + settingConfigs[pluginId] = defaultActionSettings[plugin.type]; + } else { + settingConfigs[pluginId] = pluginFormData[index].setting; + } + // Action dependencies config if not available use default + if (plugin && !pluginFormData[index].dependencies) { + dependencies[pluginId] = + defaultActionDependenciesConfig[plugin.type]; + } else { + dependencies[pluginId] = pluginFormData[index].dependencies; + } + // Datasource form buttons config if not available use default + if (plugin && !pluginFormData[index].formButton) { + datasourceFormButtonConfigs[pluginId] = + defaultDatasourceFormButtonConfig[plugin.type]; + } else { + datasourceFormButtonConfigs[pluginId] = + pluginFormData[index].formButton; + } } } }); + + log.error("pluginIdFormsToFetch values added"); yield put( fetchPluginFormConfigsSuccess({ formConfigs, @@ -162,6 +172,7 @@ function* fetchPluginFormConfigsSaga() { datasourceFormButtonConfigs, }), ); + log.error("pluginIdFormsToFetch success handler called"); } catch (error) { log.error(error); yield put({