fix: empty error toast message in CI issue fixed (#28010)

## 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”>
This commit is contained in:
sneha122 2023-10-16 11:40:55 +05:30 committed by GitHub
parent 0da5865cb8
commit 094e859973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,6 +94,7 @@ function* fetchPluginFormConfigsSaga() {
for (const pluginId of actionPluginIds) {
pluginIdFormsToFetch.add(pluginId);
}
log.error("pluginIdFormsToFetch acquired");
const pluginFormData: PluginFormPayload[] = [];
const pluginFormResponses: ApiResponse<PluginFormPayload>[] = 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({