fix: redirect new users to onboarding from plugin connect page#908
Open
vorflux[bot] wants to merge 1 commit intomainfrom
Open
fix: redirect new users to onboarding from plugin connect page#908vorflux[bot] wants to merge 1 commit intomainfrom
vorflux[bot] wants to merge 1 commit intomainfrom
Conversation
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 (skip or finish), 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'. - Wait for full auth state before showing the connect card. - Extract PENDING_CONNECT_URL_KEY and consumePendingConnectUrl() to a shared constants file with 7 unit tests.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 88f9fb2 | May 07 2026, 10:56 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 88f9fb2 | Commit Preview URL Branch Preview URL |
May 07 2026, 10:57 PM |
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.Supersedes #895 (fresh branch from latest main).
Solution
Detect new users on the connect page and automatically redirect them to onboarding, stashing the full connect URL in
sessionStorage.After onboarding completes, skip and completion paths check
sessionStoragefor a pending connect URL and redirect back to it instead of "/". This covers:handleSkip()in the new onboarding page (creates org then redirects)goHomeOrPendingConnect()for the "Go to home" buttonInitialHeader.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 orgapps/web/app/(app)/onboarding/page.tsx--handleSkip()and "Go to home" button useconsumePendingConnectUrl()to redirect back to the connect page if pendingapps/web/components/initial-header.tsx--handleSkip()checks for pending connect URLapps/web/lib/constants.ts-- New sharedPENDING_CONNECT_URL_KEYconstant andconsumePendingConnectUrl()helperapps/web/lib/__tests__/constants.test.ts-- 7 unit tests for the helperTesting
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 pathconsumePendingConnectUrlSession Details
(aside)to your comment to have me ignore it.