diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/delegates/TurboWebFragmentDelegate.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/delegates/TurboWebFragmentDelegate.kt index 9483558e..a62f14d0 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/delegates/TurboWebFragmentDelegate.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/delegates/TurboWebFragmentDelegate.kt @@ -191,6 +191,7 @@ internal class TurboWebFragmentDelegate( } override fun visitRendered() { + callback.onVisitRendered(location) navDestination.fragmentViewModel.setTitle(title()) removeTransitionalViews() } diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/fragments/TurboWebFragmentCallback.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/fragments/TurboWebFragmentCallback.kt index 7ac6d92a..ecb93ccd 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/fragments/TurboWebFragmentCallback.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/fragments/TurboWebFragmentCallback.kt @@ -56,6 +56,13 @@ interface TurboWebFragmentCallback { */ fun onVisitStarted(location: String) {} + /** + * Called when a Turbo visit has rendered (from a cached snapshot or + * from a fresh network request). This may be called multiple times + * during a normal visit lifecycle. + */ + fun onVisitRendered(location: String) {} + /** * Called when a Turbo visit has completed. */