-
Notifications
You must be signed in to change notification settings - Fork 0
[UI] Navigation context management — context-return and org switch wipe (Phase 11) #438
Copy link
Copy link
Open
Open
Copy link
Milestone
Description
Phase 11 — Navigation Context Management
Implement context-return navigation and organization context wipe. This is split from #411 which covered Deep Link Registration, Context-Return Navigation, and Org Context Wipe together.
POL-08: Context-Return Navigation
When a user initiates a child flow from within a specific parent context, successful completion must return them to that parent context.
Cases requiring context-return:
- Unit Detail: Create task from "+" in unit context → return to Unit Detail (Tasks tab) on save
- Unit Detail: View a document → return to Unit Detail (Documents tab) on back
- Request Review List: Approve request, fill AddEditTask → return to Request Review List on save
Implementation: pass returnRoute: Route? as a serialized navigation argument when navigating to the child screen. On successful completion the ViewModel navigates to returnRoute ?: defaultDestination.
POL-09: Organization Context Wipe on Org Switch
When a user switches organizations via the org switcher (from #392):
- Clear the navigation back stack:
navController.navigate(Route.Dashboard) { popUpTo(0) { inclusive = true } } - Clear in-memory caches in all Managers — each Manager observes
currentOrgId: StateFlow<String?>from OrgContext and callsinvalidateCache()on change - Update OrgContext singleton with new org ID
- No stale org-scoped IDs remain in any ViewModel or Manager after the switch
Manager cache invalidation pattern:
init {
orgContext.currentOrgId
.distinctUntilChanged()
.onEach { invalidateCache() }
.launchIn(managerScope)
}Dependencies
- [ORG] My Organizations screen + Org Detail + Leave/Transfer ownership (Phase 1) #392 — Org membership/switching (trigger point for POL-09)
- All feature screens (context-return can only be wired once target screens exist)
- [POLISH] Deep link registration for core entities (Phase 11) #411 — Deep Link Registration (separate issue, same epic)
What type of task is this?
Development
Reactions are currently unavailable