diff --git a/desktop/src/app/App.tsx b/desktop/src/app/App.tsx index 3075eb80a..df0507513 100644 --- a/desktop/src/app/App.tsx +++ b/desktop/src/app/App.tsx @@ -521,7 +521,7 @@ function CommunityApp({ if (community.needsSetup) { // Show welcome setup for first-run users with no communities appContent = ( - diff --git a/desktop/src/features/communities/ui/WelcomeSetup.tsx b/desktop/src/features/communities/ui/WelcomeSetup.tsx index 39c425aa3..40754a73e 100644 --- a/desktop/src/features/communities/ui/WelcomeSetup.tsx +++ b/desktop/src/features/communities/ui/WelcomeSetup.tsx @@ -80,7 +80,14 @@ export function WelcomeSetup({ React.useEffect(() => { const step = onboardingHistory.step; if (!step) { - onboardingHistory.replace(routeForWelcomePage(page)); + if (canReturnToMachineConfig) { + onboardingHistory.replace(routeForWelcomePage(page)); + } else { + // Leaving the final community starts a new discovery flow. Retire the + // app history behind it so browser Back cannot escape to a route that + // no longer has an active community. + onboardingHistory.reset(routeForWelcomePage(page)); + } return; } if (isMachineOnboardingRouteStep(step)) return; @@ -97,8 +104,10 @@ export function WelcomeSetup({ setIsHostedSignInOpen(false); setPage(pageForWelcomeRoute(step)); }, [ + canReturnToMachineConfig, onboardingHistory.direction, onboardingHistory.replace, + onboardingHistory.reset, onboardingHistory.step, page, ]); @@ -209,7 +218,7 @@ export function WelcomeSetup({ -{canReturnToMachineConfig ? ( + {canReturnToMachineConfig ? (