[Solved] Can a composable be skipped even if a par...
# compose
l
[Solved] Can a composable be skipped even if a parameter to a modifier has changed? Example in 🧵
I have an interface that handles touch events for a Canvas composable called DrawHandler. I have the following method
Copy code
@Composable
fun Drawing(drawObjects: List<DrawObject>, drawHandler: TouchHandler) {
    println("Draw handler is $drawHandler in drawing")
    Canvas(modifier = Modifier.fillMaxSize().handleDraw(drawHandler).clipToBounds()) {
        ... draw stuff based on drawObjects
    }
}
I need to be able to swap out my draw handler, and the new one should receive touch events.
I see that the value printed by the log changes from DrawImpl@49051c9 to DrawImpl@add3299, but my log inside handleDraw only says it gets called with DrawImpl@49051c9
Just realized my mistake. If it helps anyone, my handleDraw method used pointerInput(Unit) instead of pointerInput(drawHandler)
Changing it to pointerInput(drawHandler) caused changes to drawHandler to force recomposition of Canvas.