X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/a2bf1ed3a15cf55e426c51ad8e6febd7ff2e3020..3a3de86b86ef60fc86f1190d42bc8a2471ab5276:/src/store/trash/trash-actions.ts?ds=inline diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts index 5cf952eb..92d01582 100644 --- a/src/store/trash/trash-actions.ts +++ b/src/store/trash/trash-actions.ts @@ -10,6 +10,8 @@ import { trashPanelActions } from "~/store/trash-panel/trash-panel-action"; import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "~/store/side-panel-tree/side-panel-tree-actions"; import { projectPanelActions } from "~/store/project-panel/project-panel-action"; import { ResourceKind } from "~/models/resource"; +import { navigateToTrash } from '~/store/navigation/navigation-action'; +import { matchCollectionRoute } from '~/routes/routes'; export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed: boolean) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise => { @@ -46,8 +48,12 @@ export const toggleCollectionTrashed = (uuid: string, isTrashed: boolean) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise => { try { if (isTrashed) { + const { location } = getState().router; dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash..." })); await services.collectionService.untrash(uuid); + if (matchCollectionRoute(location ? location.pathname : '')) { + dispatch(navigateToTrash); + } dispatch(trashPanelActions.REQUEST_ITEMS()); dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restored from trash",