fix(platform): redirect to create-organization instead of auto-creating Default org#1698
Conversation
…ng Default org When a user has no organizations, route them to the create-organization page rather than silently creating a "Default" org and initializing workflows.
📝 WalkthroughWalkthroughThe PR removes automatic default organization creation from the dashboard index route. When the organizations list is empty, the component now redirects users to Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
services/platform/app/routes/dashboard/index.tsx (1)
43-55:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon’t gate the zero-org redirect on
lastActiveOrgIdloading.At Line 45,
isLastActiveLoadingblocks all paths, including the Line 51 zero-organization redirect. Users with no orgs should be redirected as soon as org membership is known; otherwise they can be stuck waiting on an unrelated query.🔧 Suggested fix
useEffect(() => { if ( isOrgsLoading || - isLastActiveLoading || !organizations || resolvedRef.current ) return; if (organizations.length === 0) { resolvedRef.current = true; void navigate({ to: '/dashboard/create-organization' }); return; } + + if (isLastActiveLoading) return; resolvedRef.current = true;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@services/platform/app/routes/dashboard/index.tsx` around lines 43 - 55, The early-return gating currently includes isLastActiveLoading which prevents the zero-organization redirect from firing; update the condition so the early return only depends on isOrgsLoading, organizations, and resolvedRef.current (i.e., remove isLastActiveLoading from the if that returns early), then keep the subsequent organizations.length === 0 branch that sets resolvedRef.current = true and calls navigate('/dashboard/create-organization') so users with no orgs are redirected immediately even if lastActiveOrgId is still loading.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@services/platform/app/routes/dashboard/index.tsx`:
- Around line 43-55: The early-return gating currently includes
isLastActiveLoading which prevents the zero-organization redirect from firing;
update the condition so the early return only depends on isOrgsLoading,
organizations, and resolvedRef.current (i.e., remove isLastActiveLoading from
the if that returns early), then keep the subsequent organizations.length === 0
branch that sets resolvedRef.current = true and calls
navigate('/dashboard/create-organization') so users with no orgs are redirected
immediately even if lastActiveOrgId is still loading.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a03565d5-8e51-4216-b76a-4ad2f1976fcb
📒 Files selected for processing (1)
services/platform/app/routes/dashboard/index.tsx
…ions When a workflow consumes an OAuth2 integration whose refresh token Google (or any provider) has revoked, the only signal was a generic "Please re-authorize" in workflow logs and no indication on the Integrations page — operators had to grep Convex logs to find the real `invalid_grant` reason. - decrypt_and_refresh_oauth2.ts: parse the token endpoint's RFC 6749 §5.2 error body and append `(error_code: description)` to the thrown message so it lands in wfExecutions.error. Mark the credential row with status='error' + errorMessage + lastErrorAt on every refresh-failure path (HTTP non-2xx, missing prerequisites, missing access_token in 200 response); clear back to status='active' + lastSuccessAt on success. - IntegrationCard: accept an optional `status` prop and render a destructive "Reconnect needed" badge when status === 'error', taking precedence over the isActive "Connected" badge. - integrations.tsx: pass the merged status through to the card. - en/de/fr: add `integrations.badge.reconnectNeeded` key. - Test: assert that status='error' beats isActive on the card. No schema migration: status/errorMessage/lastErrorAt already exist on integrationCredentials. Re-authorizing the integration flips status back to 'active' via the existing success path.
Follow-up to a9fe4e6: the list card flips to red "Reconnect needed" when status='error', but the details drawer still rendered a green "Active" indicator because IntegrationIconUpload only looked at isActive (= drawer-is-in-details-mode, not credential health). Thread the credential row's `status` through IntegrationPanel into IntegrationIconUpload and make `status === 'error'` win over `isActive` in the StatusIndicator branch. Adds an `integrations.upload.reconnectNeeded` key alongside the existing active/inactive labels in en/de/fr.
…solving On first render of /dashboard/$id/settings/integrations, useOrganization hasn't resolved yet, so orgSlug falls back to '' and the action fires with an empty slug. The server-side validateOrgSlug rejects it and throws "Invalid org slug:" — TanStack Query refetches once the real slug arrives, so users never notice, but every page load polluted the Convex log with one bogus error. Gate the query with `enabled: orgSlug !== ''` so it waits for the caller to supply a slug. Chat callers pass the literal 'default', so they keep firing unchanged.
Summary
/dashboard/create-organizationinstead of silently creating aDefaultorg and initializing workflows.initializeDefaultWorkflowsaction call and the inlinecreateDefaultOrganizationhelper from the dashboard index route.Test plan
/dashboard/create-organization(noDefaultorg auto-created).bun run checkpasses.Summary by CodeRabbit