web/satellite: fix redundant onboarding tour redirection

This change ensures that we only trigger a redirect to the onboarding
tour if we're not already there. Previously, we didn't take the current
route into consideration when redirecting. This exposed the risk of an
error occurring that prevented the page from loading.

Change-Id: I70323b21f58229abf463a7c737c262e4253f579a
This commit is contained in:
Jeremy Wharton 2023-04-18 08:32:05 -05:00 committed by Storj Robot
parent 4ae05afb24
commit 53bd6bf787

View File

@ -722,15 +722,12 @@ onMounted(async () => {
} else {
selectProject(projects);
}
if (usersStore.shouldOnboard) {
const firstOnboardingStep = appStore.state.config.pricingPackagesEnabled ? RouteConfig.PricingPlanStep : RouteConfig.OverviewStep;
const onboardingPath = RouteConfig.OnboardingTour.with(firstOnboardingStep).path;
const firstOnboardingStep = appStore.state.config.pricingPackagesEnabled ? RouteConfig.PricingPlanStep : RouteConfig.OverviewStep;
const onboardingPath = RouteConfig.OnboardingTour.with(firstOnboardingStep).path;
if (usersStore.shouldOnboard && router.currentRoute.path !== onboardingPath) {
await analytics.pageVisit(onboardingPath);
await router.push(onboardingPath);
appStore.changeState(FetchState.LOADED);
return;
}
} catch (error) {
notify.error(error.message, AnalyticsErrorEventSource.OVERALL_APP_WRAPPER_ERROR);