Switch Active Organization Context Within the App
Peer mentors affiliated with multiple organizations (a scenario specifically called out for NHF with up to 5 local chapters) need to be able to switch their active tenant context mid-session. The multi-org context switcher should be accessible from a consistent location (e.g., the hamburger menu or a persistent switcher widget). When switching, the app re-initializes the RLS policy, clears org-specific caches (org branding, feature flags, terminology), and navigates the user to the home screen of the newly selected organization. A visual indicator should always show which organization the user is currently working in.
User Story
Acceptance Criteria
- Given a peer mentor is logged in with multiple org memberships, when they open the context switcher, then all their organizations are listed with the currently active one clearly indicated
- Given the context switcher is open, when the peer mentor selects a different organization, then the tenant context service updates the active org, RLS is reconfigured, and the user is navigated to the home screen
- Given the user switches organization, when the switch completes, then org-specific caches (branding, feature flags, terminology) are cleared and reloaded for the new organization
- Given the user is on any screen, when they look at the navigation or header area, then the currently active organization name is visible
- Given a peer mentor belongs to only one organization, when they navigate to settings or the menu, then the organization switching option is not displayed
Business Value
Multi-chapter membership is a documented real-world scenario for NHF peer mentors. Without a seamless switching mechanism, these users would need to log out and log in between chapters, creating friction that leads to underreporting. Smooth context switching also prevents cross-organization data leakage, which is essential for maintaining the integrity of each organization's private member and activity data.
Components
- Multi-Organization Context Switcher ui
- Tenant Context Service service
- Organization Selection Service service
- Multi-Organization Membership Resolver service
- Organization Repository data
- Tenant Session Store data
- Organization Branding Cache data
- Supabase RLS Tenant Scope Configurator infrastructure