Dispose WebView in Compose
Inside the compose wrapper of the Android Webview, I added the DisposableEffect to dispose the webview right after user leaves the screen to prevent webview duplication and zombie sessions
DisposableEffect(Unit) {
onDispose {
webview?.apply {
stopLoading()
onPause()
removeAllViews()
destroy()
}
webview = null
}
}