Skip to content

Commit

Permalink
Merge pull request #307 from hotwired/dialog-clear-backstack
Browse files Browse the repository at this point in the history
Fix `clearBackStack()` from a bottom sheet dialog fragment
  • Loading branch information
jayohms authored Feb 24, 2024
2 parents 6ab923c + efd1956 commit d1b75ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ internal class TurboNavigator(private val navDestination: TurboNavDestination) {
}

onNavigationVisit {
if (fragment is DialogFragment) {
fragment.requireDialog().cancel()
}

val controller = currentController()
controller.popBackStack(controller.graph.startDestinationId, false)
onCleared()
Expand Down

0 comments on commit d1b75ab

Please sign in to comment.