Skip to content

Commit 635af92

Browse files
Rudraprasad Dastrishaanand
authored andcommitted
fix: fixing redirect from ds modal after import (#31834)
## Description Redirection issue on DS Reconfigure modal after user imports the application ## Automation /ok-to-test tags="@tag.Fork,@tag.ImportExport" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8295348027> > Commit: `16953d533498713ec3e3eefb943614b20bdd5b95` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8295348027&attempt=2" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved the redirection logic in the `ReconnectDatasourceModal` to ensure users are navigated correctly based on their current application context. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 77bb2a4 commit 635af92

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/client/src/pages/Editor/gitSync/ReconnectDatasourceModal.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import { getFetchedWorkspaces } from "@appsmith/selectors/workspaceSelectors";
7575
import { getApplicationsOfWorkspace } from "@appsmith/selectors/selectedWorkspaceSelectors";
7676
import useReconnectModalData from "@appsmith/pages/Editor/gitSync/useReconnectModalData";
7777
import { resetImportData } from "@appsmith/actions/workspaceActions";
78-
import history from "utils/history";
7978

8079
const Section = styled.div`
8180
display: flex;
@@ -439,6 +438,11 @@ function ReconnectDatasourceModal() {
439438
// If either the close button or the overlay was clicked close the modal
440439
if (shouldClose) {
441440
onClose();
441+
const isInsideApplication =
442+
window.location.pathname.split("/")[1] === "app";
443+
if (isInsideApplication && editorURL) {
444+
window.location.href = editorURL;
445+
}
442446
}
443447
}
444448
};
@@ -563,7 +567,10 @@ function ReconnectDatasourceModal() {
563567
const onSkipBtnClick = () => {
564568
AnalyticsUtil.logEvent("RECONNECTING_SKIP_TO_APPLICATION_BUTTON_CLICK");
565569
localStorage.setItem("importedAppPendingInfo", "null");
566-
editorURL && history.push(editorURL);
570+
if (editorURL) {
571+
// window location because history push changes routes shallowly and some side effects needed for page loading might not run
572+
window.location.href = editorURL;
573+
}
567574
onClose();
568575
};
569576

0 commit comments

Comments
 (0)