fix(geohash): cleanup sampling subscriptions when closing location sheet (#659)

- Added DisposableEffect to LocationChannelsSheet to ensure cleanup runs when composable is removed
- Fixed ChatViewModel.endGeohashSampling() to correctly delegate to GeohashViewModel instead of being a no-op
- Prevents lingering kind 20001 subscriptions after closing the sheet
This commit is contained in:
a1denvalu3
2026-01-31 16:42:20 +01:00
committed by GitHub
parent 06d2665b70
commit f79451b615
2 changed files with 8 additions and 1 deletions
@@ -1046,7 +1046,7 @@ class ChatViewModel(
* End geohash sampling
*/
fun endGeohashSampling() {
// No-op in refactored architecture; sampling subscriptions are short-lived
geohashViewModel.endGeohashSampling()
}
/**
@@ -542,6 +542,13 @@ fun LocationChannelsSheet(
viewModel.endGeohashSampling()
}
}
// Ensure cleanup when the composable is destroyed (e.g. removed from parent composition)
DisposableEffect(Unit) {
onDispose {
viewModel.endGeohashSampling()
}
}
}
@Composable