modals-are-closed-after-using-browsers-back-or-forward-option
[arvados-workbench2.git] / src / routes / route-change-handlers.ts
index c4b0fc7d5d5486f8be4fc30896a5296407c90ed2..655c806f3a3b0337cc1a89eccae6b7a29ddaa832 100644 (file)
@@ -7,6 +7,7 @@ import { RootStore } from '~/store/store';
 import * as Routes from '~/routes/routes';
 import * as WorkbenchActions from '~/store/workbench/workbench-actions';
 import { navigateToRootProject } from '~/store/navigation/navigation-action';
+import { dialogActions } from '~/store/dialog/dialog-actions';
 
 export const addRouteChangeHandlers = (history: History, store: RootStore) => {
     const handler = handleLocationChange(store);
@@ -38,6 +39,8 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const userMatch = Routes.matchUsersRoute(pathname);
     const linksMatch = Routes.matchLinksRoute(pathname);
 
+    store.dispatch(dialogActions.CLOSE_ALL_DIALOGS());
+
     if (projectMatch) {
         store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id));
     } else if (collectionMatch) {