Switch Organization During an Active Session
Peer mentors who are members of multiple organizations need to switch between them without going through the full authentication flow again. The multi-org context switcher (667-multi-org-context-switcher) provides an in-session mechanism — accessible from the settings or profile menu — that re-presents the organization selection screen. On selection, the tenant context is updated, RLS policies are reconfigured for Supabase, and the app navigates back to the home screen in the new organizational context. All cached data from the previous org session is cleared to prevent cross-org data bleed.
User Story
Acceptance Criteria
- Given I am in an active session with Organization A, When I access the organization switcher in settings, Then I see a list of all my organizations with the currently active one indicated
- Given I select a different organization from the switcher, When the switch completes, Then I am taken to the home screen for the new organization and all visible data (contacts, activities, stats) reflects that organization only
- Given I switch organizations, When the new tenant context is set, Then the Supabase RLS configuration is updated to scope all queries to the new organization's data
- Given I switch organizations, When the context changes, Then any cached data (contact lists, activity types, org labels) from the previous organization is invalidated and reloaded for the new organization
- Given I am the only member of my current organization, When I open the org switcher, Then I see only my one organization and a clear indication that no other organizations are available to switch to
Business Value
NHF explicitly identified members belonging to up to 5 local chapters as a core requirement. Without in-session org switching, a peer mentor active in multiple chapters would need to log out and back in every time they shift context — creating friction severe enough to drive abandonment and underreporting. Seamless switching is a prerequisite for accurate multi-chapter activity attribution, which directly affects the quality of Bufdir compliance reporting.
Components
- Multi-Organization Context Switcher ui
- Tenant Context Service service
- Organization Selection Service service
- Organization Route Guard service
- Multi-Organization Membership Resolver service
- Organization Repository data
- Tenant Session Store data
- Organization Branding Cache data
- Supabase RLS Tenant Scope Configurator infrastructure
- Feature Flag Provider infrastructure