Sargun Vohra
11/10/2025, 3:50 AMremoveNotify), I remove the metal layer in obj-c++ like so:
CAMetalLayer* layer = (__bridge CAMetalLayer *)metalLayer.get();
[layer removeFromSuperlayer];
But an image of the map remains in the Compose UI, at least until something else is rendered there, or a resize forces the app to repaint. I already tried:
• before removing the layer, [layer.superLayer needsDisplay]
• in my canvas’s removeNotify: parent.repaint() and SwingUtilities.getWindowAncestor(this).repaint() and SwingUtilities.getWindowAncestor(this).revalidate()
---
Just before hitting send, I tried this hack:
// HACK: Force a repaint by resizing the window slightly to avoid a ghost map on macoOS.
val root = SwingUtilities.getWindowAncestor(this)
val oWidth = root.width
val oHeight = root.height
root.size = Dimension(oWidth + 1, oHeight + 1)
root.size = Dimension(oWidth, oHeight)
And well, it works, but it feels wrong. Is there a better way?Dumitru Preguza
11/12/2025, 11:27 AMval text by remember { mutableStateOf("foo") }
key(text) {
YourComposableFun(
onClick = {
text = "bar"
}
) {
}
}