User Interface medium complexity mobile
2
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Dedicated UI component presented to users who hold roles in more than one partner organization. Allows clean switching between tenant contexts without logging out by re-invoking the organization selection flow. Accessible from settings and surfaces a clear current-context indicator.

Feature: Organization Selection & Onboarding

multi-org-context-switcher

Summaries

The Multi-Organization Context Switcher enables users who hold roles across more than one partner organization to seamlessly switch their active organizational context without signing out and back in. This directly addresses a significant friction point for users who work across multiple partner institutions — a common pattern in healthcare, education, or franchise networks. By eliminating forced re-authentication on context change, the platform retains users who would otherwise abandon the app or submit support tickets. The clear current-context indicator also reduces user error, preventing data being submitted under the wrong organizational identity, which has meaningful compliance and liability implications for enterprise customers.

This medium-complexity UI component depends on both the Organization Card Widget and the Tenant Context Service, meaning it cannot be completed until both dependencies are stable. Plan for two to three days of development plus integration testing time. The confirmation dialog requirement adds one additional day for UX copywriting sign-off and accessibility review. Key scheduling risk: if the Tenant Context Service is delayed, this component is blocked.

Ensure the context switch confirmation copy is approved by product and legal early, as wording around session changes can require stakeholder review. Regression testing should cover single-org users (who should never see this component), multi-org users, and users whose org membership changes between sessions.

MultiOrgContextSwitcher is a stateful Flutter widget that consumes TenantContextService to retrieve the current active org ID and the full list of organizations the authenticated user belongs to. On mount, call getCurrentOrgId() to highlight the active entry rendered via OrganizationCard. The onContextSwitch(String newOrgId) handler should call showConfirmationDialog() before invoking TenantContextService.setTenantContext() to prevent accidental switches — ensure the dialog is awaited and the switch only proceeds on user confirmation. Subscribe to watchTenantContext() stream to reactively update the highlighted card if context changes externally.

Surface from a settings route to avoid cluttering primary navigation. Test edge cases: user with exactly one org should not see this component; user whose org is deactivated mid-session should receive an error state.

Responsibilities

  • List all organizations the authenticated user belongs to
  • Highlight the currently active organization context
  • Trigger tenant context swap on selection
  • Confirm context switch to prevent accidental changes

Interfaces

build(BuildContext context)
onContextSwitch(String newOrgId)
showConfirmationDialog()
getCurrentOrgId() -> String

Relationships

Dependencies (2)

Components this component depends on