diff --git a/circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/NavigableCircuitContent.kt b/circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/NavigableCircuitContent.kt index dd23fd18d..ac9cabddb 100644 --- a/circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/NavigableCircuitContent.kt +++ b/circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/NavigableCircuitContent.kt @@ -128,7 +128,11 @@ public fun NavigableCircuitContent( LocalBackStack provides backStack, *providedLocals, ) { - provider.content(record, backStack) + provider.content( + record, + // presenterEnabled. We only enable the presenter for the top record + backStack.topRecord == record, + ) } } } @@ -139,7 +143,7 @@ public fun NavigableCircuitContent( @Immutable public class RecordContentProvider( public val record: R, - internal val content: @Composable (R, BackStack) -> Unit, + internal val content: @Composable (R, Boolean) -> Unit, ) { override fun equals(other: Any?): Boolean { if (this === other) return true @@ -183,7 +187,7 @@ private fun BackStack.buildCircuitContentProviders( RecordContentProvider( record = record, content = - movableContentOf { record, backStack -> + movableContentOf { record, presenterEnabled -> CircuitContent( screen = record.screen, modifier = Modifier, @@ -191,7 +195,7 @@ private fun BackStack.buildCircuitContentProviders( circuit = lastCircuit, unavailableContent = lastUnavailableRoute, key = record.key, - presenterEnabled = backStack.topRecord == record, + presenterEnabled = presenterEnabled, ) }, )