posthog icon indicating copy to clipboard operation
posthog copied to clipboard

fix(onboarding): retire onboarding use case feature flag and prevent crash and redirect loop on use-case selection page

Open MattBro opened this issue 1 month ago • 2 comments

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:

  1. UseCaseSelection.tsx imported onboardingLogic, which mounted its urlToAction
  2. urlToAction matched /onboarding/use-case with productKey = "use-case"
  3. Since "use-case" isn't a valid product, availableOnboardingProducts["use-case"] returned undefined
  4. The setProduct reducer returned undefined, violating Redux rules
  5. onboardingLogic redirected to / since no valid product was found
  6. sceneLogic redirected back to /onboarding/use-case, creating an infinite loop

Changes

  • Remove onboardingLogic dependency from UseCaseSelection.tsx to prevent the urlToAction from matching on this page
  • Add null coalescing to setProduct reducer to prevent undefined returns
  • Remove the ONBOARDING_USE_CASE_SELECTION feature flag entirely - ship use-case selection as the default onboarding entry point for all users
  • Update MinimalNavigation logo link to go to use-case selection when user hasn't completed onboarding
  • Maintain proper else if chain in sceneLogic redirect logic to prevent incorrect redirects when team is unavailable

How did you test this code?

  • Manually tested navigating to /onboarding/use-case directly
  • 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

MattBro avatar Dec 05 '25 17:12 MattBro

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%)

compressed-size-action

github-actions[bot] avatar Dec 05 '25 17:12 github-actions[bot]

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

Review snapshot changes →

posthog-bot avatar Dec 05 '25 18:12 posthog-bot