diff --git a/src/webapp/components/layout/side-bar/SideBarContent.tsx b/src/webapp/components/layout/side-bar/SideBarContent.tsx index 6b57a6d..2bc100e 100644 --- a/src/webapp/components/layout/side-bar/SideBarContent.tsx +++ b/src/webapp/components/layout/side-bar/SideBarContent.tsx @@ -70,8 +70,7 @@ export const SideBarContent: React.FC = React.memo( component={NavLink} to={ value === RouteName.EVENT_TRACKER || - value === RouteName.IM_TEAM_BUILDER || - value === RouteName.INCIDENT_ACTION_PLAN + value === RouteName.IM_TEAM_BUILDER ? routes[value].replace( ":id", getCurrentEventTracker()?.id || "" diff --git a/src/webapp/hooks/useRoutes.ts b/src/webapp/hooks/useRoutes.ts index a51604c..4f92a63 100644 --- a/src/webapp/hooks/useRoutes.ts +++ b/src/webapp/hooks/useRoutes.ts @@ -31,7 +31,7 @@ export const routes: Record = { [RouteName.EDIT_FORM]: `/edit/${formType}/:id`, [RouteName.EVENT_TRACKER]: "/event-tracker/:id", [RouteName.IM_TEAM_BUILDER]: "/incident-management-team-builder/:id", - [RouteName.INCIDENT_ACTION_PLAN]: "/incident-action-plan/:id", + [RouteName.INCIDENT_ACTION_PLAN]: "/incident-action-plan", [RouteName.RESOURCES]: "/resources", [RouteName.DASHBOARD]: "/", } as const; @@ -41,7 +41,7 @@ type RouteParams = { [RouteName.EDIT_FORM]: { formType: FormType; id: string }; [RouteName.EVENT_TRACKER]: { id: string }; [RouteName.IM_TEAM_BUILDER]: { id: string }; - [RouteName.INCIDENT_ACTION_PLAN]: { id: string }; + [RouteName.INCIDENT_ACTION_PLAN]: undefined; [RouteName.RESOURCES]: undefined; [RouteName.DASHBOARD]: undefined; }; diff --git a/src/webapp/pages/form-page/useForm.ts b/src/webapp/pages/form-page/useForm.ts index 80945f9..f604355 100644 --- a/src/webapp/pages/form-page/useForm.ts +++ b/src/webapp/pages/form-page/useForm.ts @@ -279,10 +279,7 @@ export function useForm(formType: FormType, id?: Id): State { }); break; case "incident-response-action": - if (currentEventTracker?.id) - goTo(RouteName.INCIDENT_ACTION_PLAN, { - id: currentEventTracker.id, - }); + if (currentEventTracker?.id) goTo(RouteName.INCIDENT_ACTION_PLAN); setGlobalMessage({ text: i18n.t(`Incident Response Actions saved successfully`), type: "success", @@ -325,12 +322,9 @@ export function useForm(formType: FormType, id?: Id): State { id: currentEventTracker.id, }); break; - case "incident-action-plan": case "incident-response-action": - goTo(RouteName.INCIDENT_ACTION_PLAN, { - id: currentEventTracker.id, - }); + goTo(RouteName.INCIDENT_ACTION_PLAN); break; default: goTo(RouteName.EVENT_TRACKER, { diff --git a/src/webapp/pages/incident-action-plan/IncidentActionPlanPage.tsx b/src/webapp/pages/incident-action-plan/IncidentActionPlanPage.tsx index 3c99727..8e5f6b1 100644 --- a/src/webapp/pages/incident-action-plan/IncidentActionPlanPage.tsx +++ b/src/webapp/pages/incident-action-plan/IncidentActionPlanPage.tsx @@ -1,7 +1,6 @@ import React, { useCallback } from "react"; import i18n from "../../../utils/i18n"; import { Layout } from "../../components/layout/Layout"; -import { useParams } from "react-router-dom"; import { useCurrentEventTracker } from "../../contexts/current-event-tracker-context"; import { useIncidentActionPlan } from "./useIncidentActionPlan"; import { Box, Typography } from "@material-ui/core"; @@ -13,10 +12,9 @@ import { Loader } from "../../components/loader/Loader"; import { ResponseActionTable } from "./ResponseActionTable"; export const IncidentActionPlanPage: React.FC = React.memo(() => { - const { id } = useParams<{ - id: string; - }>(); const { getCurrentEventTracker } = useCurrentEventTracker(); + const currentEventTracker = getCurrentEventTracker(); + const id = currentEventTracker?.id || ""; const { actionPlanSummary, @@ -42,7 +40,7 @@ export const IncidentActionPlanPage: React.FC = React.memo(() => { return ( {!actionPlanSummary && responseActionRows.length === 0 && !summaryError && } {!incidentActionExists ? (