Fix node removal hang by adding navigation callback (#2134)

This commit is contained in:
Jeremiah K 2025-06-16 11:52:57 -05:00 committed by GitHub
parent a5ade9252a
commit 00295c969e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -129,6 +129,9 @@ fun NavGraphBuilder.nodeDetailGraph(
onNavigate = {
navController.navigate(it)
},
onNavigateUp = {
navController.navigateUp()
},
viewModel = hiltViewModel(parentEntry),
)
}

View file

@ -184,6 +184,7 @@ fun NodeDetailScreen(
uiViewModel: UIViewModel = hiltViewModel(),
navigateToMessages: (String) -> Unit,
onNavigate: (Route) -> Unit = {},
onNavigateUp: () -> Unit = {},
) {
val state by viewModel.state.collectAsStateWithLifecycle()
val environmentState by viewModel.environmentState.collectAsStateWithLifecycle()
@ -229,6 +230,9 @@ fun NodeDetailScreen(
val channel =
if (hasPKC) DataPacket.PKC_CHANNEL_INDEX else node.channel
navigateToMessages("$channel${node.user.id}")
} else if (action is NodeMenuAction.Remove) {
uiViewModel.handleNodeMenuAction(action)
onNavigateUp()
} else {
uiViewModel.handleNodeMenuAction(action)
}