supermemory/apps/web/components/onboarding-brain
MaheshtheDev db7f5c3f64 fix(web): select the correct Company Brain workspace (#1372)
## What changed

- Make `/brain` reuse the active Company Brain, switch to a single existing Company Brain, show a picker for multiple choices, or create one only when none exists.
- Wait for active-organization restoration before making that decision.
- Make Company Brain onboarding match organizations by the confirmed company domain and never offer unrelated-domain workspaces.
- Create a new Company Brain when no matching workspace exists and show an actionable workspace-limit toast when creation is blocked.
- Improve the organization picker, loading, and error states.

## Why

The previous flows could use or mutate the currently active normal organization, start research against stale Company Brain metadata, or offer unrelated Company Brain workspaces after a quota failure.

## Impact

Normal organizations are no longer silently converted. Research is scoped to the Company Brain for the confirmed domain, and users receive a clear recovery path when they reach their workspace limit.

This keeps the existing `{ domain }` research API contract; no organization-reconfiguration API is required.

## Validation

- Biome checks passed for all five changed web files
- Targeted web TypeScript diagnostics reported no errors for the changed files
- React Doctor against `origin/main`: no issues found
- `git diff --check`

No test files were added.
2026-07-28 06:14:22 +00:00
..
company-brain-onboarding.tsx fix(web): select the correct Company Brain workspace (#1372) 2026-07-28 06:14:22 +00:00
onboarding-confetti.tsx feat(web): make brain onboarding the default flow (#1067) 2026-06-09 17:13:32 +00:00
research-action-rail.tsx feat(web): revamp Company Brain configure page (#1306) 2026-07-18 18:45:03 +00:00
shell.tsx company brain responsiveness (#1239) 2026-07-16 01:57:51 +00:00
slack-handoff.tsx feat(brain): add /brain Slack-first onboarding entry (#1310) 2026-07-21 21:19:54 +00:00
step-about.tsx feat(web): open company brain signup to everyone (#1342) 2026-07-22 21:05:53 +00:00
step-ingest.tsx feat(web): company brain onboarding redesign + connector entitlement (#1178) 2026-06-30 22:01:20 +00:00
step-sources.tsx company brain responsiveness (#1239) 2026-07-16 01:57:51 +00:00
step-team.tsx company brain responsiveness (#1239) 2026-07-16 01:57:51 +00:00
types.ts fix(web): select the correct Company Brain workspace (#1372) 2026-07-28 06:14:22 +00:00