From de8a20651e5bea1dba6d80f6c169a7122550d8ea Mon Sep 17 00:00:00 2001 From: rahulkeswani101 Date: Tue, 13 Aug 2024 11:13:32 +0530 Subject: [PATCH] fix: redirect users to previous page after clicking back on onboarding flow instead of services page --- .../OnboardingContainer/OnboardingContainer.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/container/OnboardingContainer/OnboardingContainer.tsx b/frontend/src/container/OnboardingContainer/OnboardingContainer.tsx index 3129d76c8e..c1275ff115 100644 --- a/frontend/src/container/OnboardingContainer/OnboardingContainer.tsx +++ b/frontend/src/container/OnboardingContainer/OnboardingContainer.tsx @@ -247,8 +247,7 @@ export default function Onboarding(): JSX.Element { const handleNext = (): void => { if (activeStep <= 3) { - handleNextStep(); - history.replace(moduleRouteMap[selectedModule.id as ModulesMap]); + history.push(moduleRouteMap[selectedModule.id as ModulesMap]); } }; @@ -258,6 +257,13 @@ export default function Onboarding(): JSX.Element { updateSelectedDataSource(null); }; + const handleBackNavigation = (): void => { + setCurrent(0); + setActiveStep(1); + setSelectedModule(useCases.APM); + resetProgress(); + }; + useEffect(() => { const { pathname } = location; @@ -277,9 +283,11 @@ export default function Onboarding(): JSX.Element { } else if (pathname === ROUTES.GET_STARTED_AZURE_MONITORING) { handleModuleSelect(useCases.AzureMonitoring); handleNextStep(); + } else { + handleBackNavigation(); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [location.pathname]); const [form] = Form.useForm(); const [