fix: Updating the conditions for URL update on click of go to application button in import application modal (#27122)

## Description

Reconnect datasource modal that opens up when we import an application
shows a `Go to application` button. On clicking this button, sometimes
the URL update for this button takes time. If the button is being
clicked immediately after the modal opens, and when the app is imported
via app-level import, the `pageId` used in this URL is still the old
pageId that needs to be updated to new home `pageId` we get via import
application API. After few seconds the URL updates correctly. Fixing
this issue via this PR.

#### PR fixes following issue(s)
Fixes [#26978](https://github.com/appsmithorg/appsmith/issues/26978)

#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress

## Checklist:
#### Dev activity
- [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
- [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
This commit is contained in:
Ankita Kinger 2023-09-14 16:13:54 +05:30 committed by GitHub
parent 64161e36c8
commit 2696b94000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -474,7 +474,7 @@ function ReconnectDatasourceModal() {
}, [importedApplication, queryIsImport]);
useEffect(() => {
if (pageId && appId && datasources.length) {
if (pageId) {
// TODO: Update route params here
setAppURL(
builderURL({
@ -482,7 +482,7 @@ function ReconnectDatasourceModal() {
}),
);
}
}, [pageId, appId, datasources]);
}, [pageId]);
// checking of full configured
useEffect(() => {
@ -516,7 +516,7 @@ function ReconnectDatasourceModal() {
JSON.stringify(appInfo),
);
}
} else if (appURL) {
} else if (appURL && unconfiguredDatasources.length === 0) {
// open application import successfule
localStorage.setItem("importApplicationSuccess", "true");
localStorage.setItem("importedAppPendingInfo", "null");

View File

@ -45,10 +45,12 @@ import {
getPluginByPackageName,
getDatasourcesUsedInApplicationByActions,
getEntityExplorerDatasources,
getUnconfiguredDatasources,
} from "@appsmith/selectors/entitiesSelector";
import {
addMockDatasourceToWorkspace,
setDatasourceViewModeFlag,
setUnconfiguredDatasourcesDuringImport,
} from "actions/datasourceActions";
import type {
UpdateDatasourceSuccessAction,
@ -523,6 +525,14 @@ function* updateDatasourceSaga(
kind: "success",
});
const unconfiguredDSList: Datasource[] = yield select(
getUnconfiguredDatasources,
);
const updatedList = unconfiguredDSList.filter(
(d: Datasource) => d.id !== datasourcePayload?.id,
);
yield put(setUnconfiguredDatasourcesDuringImport(updatedList));
const expandDatasourceId = state.ui.datasourcePane.expandDatasourceId;
// Dont redirect if action payload has an onSuccess