fix: redirect new users to onboarding from plugin connect page#895
Open
vorflux[bot] wants to merge 1 commit intomainfrom
Open
fix: redirect new users to onboarding from plugin connect page#895vorflux[bot] wants to merge 1 commit intomainfrom
vorflux[bot] wants to merge 1 commit intomainfrom
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 0f3f17b | May 04 2026, 06:45 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 0f3f17b | Commit Preview URL Branch Preview URL |
May 04 2026, 06:46 PM |
New users arriving at /auth/connect (e.g. from OpenCode CLI) had no organization yet, causing the 'Approve Connection' button to silently fail. The handleConnect guard 'if (!session || !org) return' would fire with no feedback, leading to rage-clicking. Changes: - Detect logged-in users with no org on the connect page and redirect them to onboarding, stashing the connect URL in sessionStorage. - After onboarding completes, redirect back to the connect page so the plugin auth flow finishes automatically. - Show an error message instead of silently returning when session/org is missing and the user clicks 'Approve Connection'. - Extract PENDING_CONNECT_URL_KEY to a shared constants file.
28eecf4 to
0f3f17b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
New users arriving at
/auth/connect(e.g. from the OpenCode CLI plugin) have no organization yet. The "Approve Connection" button'shandleConnectfunction had a silent guard:This caused the button to do absolutely nothing for new users. PostHog session recordings show users rage-clicking "Approve Connection" 8+ times across 5+ minutes with zero feedback, eventually giving up or stumbling into onboarding by accident.
Evidence from PostHog:
019dcf46(ramonpg91@gmail.com): 110 clicks, 8 rage-click events on "Approve Connection" over 5 minutes. User only discovered onboarding after navigating away.019de4cd(zongsi@wherobots.com): Same pattern -- 54 clicks, 2 rage-click events, 22-minute session for what should be a 30-second flow.Root cause: The
/auth/connectpage sits outside the(app)route group, so it doesn't have theEnsureWorkspacewrapper that redirects org-less users to onboarding on all other pages.Solution
Detect new users on the connect page and automatically redirect them to onboarding, stashing the full connect URL in
sessionStorage.After onboarding completes, all completion/skip paths now check
sessionStoragefor a pending connect URL and redirect back to it instead of "/". This covers:apps/web/app/(app)/onboarding/page.tsx): "Skip for now", "Go to home", and error-state "Skip for now" buttonsfinishOnboarding()in setup layoutInitialHeader.handleSkip()(still used in login page)Show a proper error message instead of silently returning when
sessionororgis missing and the user clicks "Approve Connection".Wait for full auth state (
isRestoring,organizations) before showing the connect card, preventing existing users from seeing a false error while their org is still being restored.Changes
apps/web/app/auth/connect/page.tsx-- Added redirect-to-onboardinguseEffect,isAuthLoadingguard, error message for missing org. Updated redirect target to/onboarding(new onboarding page).apps/web/app/(app)/onboarding/page.tsx-- All 3 exit paths ("Skip for now", "Go to home", error "Skip for now") now useconsumePendingConnectUrl()to redirect back to the connect page if pending.apps/web/app/(app)/old/onboarding/setup/layout.tsx--finishOnboarding()checks for pending connect URL (old onboarding flow, kept for compatibility).apps/web/components/initial-header.tsx--handleSkip()checks for pending connect URL (still used in login page).apps/web/components/onboarding/setup/header.tsx--handleSkip()checks for pending connect URL.apps/web/components/onboarding/setup/integrations-step.tsx--handleContinue()checks for pending connect URL.apps/web/lib/constants.ts-- New sharedPENDING_CONNECT_URL_KEYconstant andconsumePendingConnectUrl()helper.apps/web/lib/__tests__/constants.test.ts-- 7 unit tests for the helper.Testing
Unit Tests
Command:
bunx vitest run apps/web/lib/__tests__/constants.test.tsResult: 7/7 PASS
Type Checking
Command:
npx tsc --noEmit(inapps/web)Result: PASS -- no new type errors (pre-existing errors in unrelated files confirmed present on
main)Lint / Format
Command:
bunx biome checkon all changed filesResult: PASS -- no issues
Browser Testing
consumePendingConnectUrlreturns correct relative pathconsumePendingConnectUrlNote: TC1 (full new-user redirect flow) requires a real authenticated session with zero orgs, which is unavailable without the production backend. The logic was verified via code inspection -- the
useEffectguard chain is exhaustive and theshouldRedirectToOnboardingboolean prevents the connect card from flashing.Session Details
(aside)to your comment to have me ignore it.