posthog
posthog copied to clipboard
fix(onboarding): retire onboarding use case feature flag and prevent crash and redirect loop on use-case selection page
Problem
This addresses this ticket where clicking the PostHog logo during onboarding caused a crash—the URL path /onboarding/use-case was being misinterpreted as a product key rather than a scene route.
When navigating to the use-case selection onboarding page, users experienced a crash and redirect loop. This happened because:
-
UseCaseSelection.tsximportedonboardingLogic, which mounted itsurlToAction -
urlToActionmatched/onboarding/use-casewithproductKey = "use-case" - Since
"use-case"isn't a valid product,availableOnboardingProducts["use-case"]returnedundefined - The
setProductreducer returnedundefined, violating Redux rules -
onboardingLogicredirected to/since no valid product was found -
sceneLogicredirected back to/onboarding/use-case, creating an infinite loop
Changes
- Remove
onboardingLogicdependency fromUseCaseSelection.tsxto prevent theurlToActionfrom matching on this page - Add null coalescing to
setProductreducer to prevent undefined returns -
Remove the
ONBOARDING_USE_CASE_SELECTIONfeature flag entirely - ship use-case selection as the default onboarding entry point for all users - Update
MinimalNavigationlogo link to go to use-case selection when user hasn't completed onboarding - Maintain proper
else ifchain insceneLogicredirect logic to prevent incorrect redirects when team is unavailable
How did you test this code?
- Manually tested navigating to
/onboarding/use-casedirectly - Verified no redirect loop occurs
- Verified the "Skip onboarding" button still works correctly
- Tested that use-case selection flows to products page correctly
🤖 Generated with Claude Code
Size Change: -314 B (-0.01%)
Total Size: 3.7 MB
ℹ️ View Unchanged
| Filename | Size | Change |
|---|---|---|
frontend/dist/toolbar.js |
3.7 MB | -314 B (-0.01%) |
Visual regression: Storybook UI snapshots updated
Changes: 6 snapshots (6 modified, 0 added, 0 deleted)
What this means:
- Snapshots have been automatically updated to match current rendering
- Next CI run will switch to CHECK mode to verify stability
- If snapshots change again, CHECK mode will fail (indicates flapping)
Next steps:
- Review the changes to ensure they're intentional
- Approve if changes match your expectations
- If unexpected, investigate component rendering