fix: redirect users to previous page after clicking back on onboarding flow instead of services page (#5685)

Co-authored-by: Vikrant Gupta <vikrant.thomso@gmail.com>
This commit is contained in:
rahulkeswani101 2024-08-28 17:48:02 +05:30 committed by GitHub
parent 8468cc863e
commit 3200fd054e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<InviteMemberFormValues>();
const [