17637: Fixes edge case while simplifying code.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 17 May 2021 21:36:03 +0000 (18:36 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 17 May 2021 21:36:03 +0000 (18:36 -0300)
The "not found" dialog appeared if trashing an indirect ancestor project
of the one being displayed, by right-clicking on the righgt side panel tree.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/store/trash/trash-actions.ts

index 5d654b76ba1b283f1a8f5cf0fb7b678d62a26635..38587deb2fed6b4e61a6650b5b94c1ed38509556 100644 (file)
@@ -8,7 +8,7 @@ import { ServiceRepository } from "~/services/services";
 import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
 import { trashPanelActions } from "~/store/trash-panel/trash-panel-action";
 import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "~/store/side-panel-tree/side-panel-tree-actions";
-import { getProjectPanelCurrentUuid, projectPanelActions } from "~/store/project-panel/project-panel-action";
+import { projectPanelActions } from "~/store/project-panel/project-panel-action";
 import { ResourceKind } from "~/models/resource";
 import { navigateTo, navigateToTrash } from '~/store/navigation/navigation-action';
 import { matchCollectionRoute } from '~/routes/routes';
@@ -28,12 +28,8 @@ export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed:
                 errorMessage = "Could not move project to trash";
                 successMessage = "Added to trash";
                 await services.groupsService.trash(uuid);
-                if (getProjectPanelCurrentUuid(getState()) === uuid) {
-                    dispatch<any>(navigateTo(ownerUuid));
-                } else {
-                    dispatch(projectPanelActions.REQUEST_ITEMS());
-                }
                 dispatch<any>(loadSidePanelTreeProjects(ownerUuid));
+                dispatch<any>(navigateTo(ownerUuid));
             }
         } catch (e) {
             dispatch(snackbarActions.OPEN_SNACKBAR({