Skip to content

refactor(navigation): hierarchical, route-dispatching CodeNavigator (Phase 1)#1073

Open
bmc08gt wants to merge 5 commits into
code/cashfrom
refactor/simplify-navigators
Open

refactor(navigation): hierarchical, route-dispatching CodeNavigator (Phase 1)#1073
bmc08gt wants to merge 5 commits into
code/cashfrom
refactor/simplify-navigators

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Phase 1 of simplifying the navigator situation inside flows. Today a flow-step author faces up to six navigator-ish handles, and LocalCodeNavigator.current silently resolves to a different instance depending on whether the screen is mounted top-level, in a flow, or re-shadowed by flowAnnotatedEntry. This makes CodeNavigator hierarchical and route-dispatching so a screen can eventually use one handle everywhere.

This lands the engine only, entirely behind the existing APIFlowNavigator and all feature call sites are untouched, so there is no runtime behavior change for existing flows.

  • CodeNavigator gains parent + isFlowNavigator + flowScope (data classclass)
  • navigate() dispatches by route type: FlowSteps land on the nearest flow stack; everything else bubbles up the parent chain to the app-root stack (restoreRouting bypasses dispatch; a FlowStep reaching the root is dropped with a TraceType.Error)
  • New intents navigateBackWithResult() and dismiss(), delegating flow/sheet mechanics to a small new FlowScope interface implemented by FlowHost
  • FlowHost wired to make it live (parent/isFlowNavigator/flowScope); sheetNavigator read via rememberUpdatedState; sheet dismiss guarded on isSheetRoot
  • First JVM unit-test harness for ui/navigation (harness + dispatch + intent tests)

bmc08gt added 5 commits July 9, 2026 11:44
…ator

- Convert CodeNavigator from data class to class (copy()/componentN() unused)
- Add optional parent, isFlowNavigator, flowScope fields (all defaulted)
- Add FlowScope interface with exitWithResult + dismiss contract
- Thread new params through rememberCodeNavigator (existing callers unaffected)
- Stand up JVM unit-test harness: TestNav fixtures + CodeNavigatorHarnessTest
- Add kotlin("test") + bundles.unit.testing to ui:navigation test deps
…t chain

FlowSteps land on the nearest flow navigator; all other routes bubble up
to the app-root stack via the parent chain, so feature screens need only
one navigator handle regardless of context.
@github-actions github-actions Bot added type: refactor Code restructuring, no behavior change area: ui Compose UI, theme, components, resources and removed type: refactor Code restructuring, no behavior change labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui Compose UI, theme, components, resources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant