From efd1956ca782341f5ba1d6ab56f17c1912bea20c Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Sat, 24 Feb 2024 09:43:01 -0500 Subject: [PATCH] Fix clearBackStack() from a bottom sheet dialog fragment --- turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavigator.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavigator.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavigator.kt index bdf6eb79..9885172d 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavigator.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavigator.kt @@ -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()