Skip to content

Commit 78aabbd

Browse files
authored
fix(navigation): handle removed step in FlowHost proceed() (#798)
* refactor(ui): extract CircularIconButton and clean up TitleBar Extract the private CircularIconButton from AppBarDefaults into a shared top-level component with a (Dp) -> Unit content lambda. Update all call sites in TitleBar to use the new size parameter, migrate material2 to material3 imports in SearchInput, and adjust padding in RegionSelectionModalContent after SearchInput lost its built-in horizontal padding. Signed-off-by: Brandon McAnsh <git@bmcreations.dev> * fix(navigation): handle removed step in FlowHost proceed() When the current step is removed from the steps list (e.g. a gate whose condition is now met), proceed() now navigates to the first remaining step instead of doing nothing. Signed-off-by: Brandon McAnsh <git@bmcreations.dev> --------- Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 003b329 commit 78aabbd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • ui/navigation/src/main/kotlin/com/getcode/navigation/flow

ui/navigation/src/main/kotlin/com/getcode/navigation/flow/FlowHost.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ private class InnerFlowNavigator<S : FlowStep, R : Parcelable>(
384384
val nextIndex = anchorIndex + 1
385385
if (anchorIndex >= 0 && nextIndex <= currentSteps.lastIndex) {
386386
navigateTo(currentSteps[nextIndex])
387+
} else if (anchorIndex < 0 && currentSteps.isNotEmpty()) {
388+
// Current step was removed from the steps list (e.g. a gate whose condition
389+
// is now met). Navigate to the first remaining step.
390+
navigateTo(currentSteps.first(), popCurrent = true)
387391
} else {
388392
val result = completedResult()
389393
if (result != null) exitWithResult(result)

0 commit comments

Comments
 (0)