Fixed scrolling to a tag/branch not working as expected

This commit is contained in:
Abdelilah El Aissaoui 2022-10-21 18:47:16 +02:00
parent a65b990a49
commit d69bdb260d

View File

@ -106,7 +106,6 @@ fun Log(
} }
if (logStatus is LogStatus.Loaded) { if (logStatus is LogStatus.Loaded) {
val coroutineScope = rememberCoroutineScope()
val hasUncommitedChanges = logStatus.hasUncommitedChanges val hasUncommitedChanges = logStatus.hasUncommitedChanges
val commitList = logStatus.plotCommitList val commitList = logStatus.plotCommitList
val verticalScrollState by logViewModel.verticalListState.collectAsState() val verticalScrollState by logViewModel.verticalListState.collectAsState()
@ -117,13 +116,13 @@ fun Log(
// the proper scroll position // the proper scroll position
verticalScrollState.observeScrollChanges() verticalScrollState.observeScrollChanges()
LaunchedEffect(Unit) { LaunchedEffect(verticalScrollState) {
coroutineScope.launch { launch {
logViewModel.focusCommit.collect { commit -> logViewModel.focusCommit.collect { commit ->
scrollToCommit(verticalScrollState, commitList, commit) scrollToCommit(verticalScrollState, commitList, commit)
} }
} }
coroutineScope.launch { launch {
logViewModel.scrollToUncommitedChanges.collect { logViewModel.scrollToUncommitedChanges.collect {
scrollToUncommitedChanges(verticalScrollState, commitList) scrollToUncommitedChanges(verticalScrollState, commitList)
} }
@ -382,7 +381,7 @@ fun MessagesList(
) )
} }
} }
items(items = commitList) { graphNode -> items(items = commitList, key = { it.name }) { graphNode ->
CommitLine( CommitLine(
graphWidth = graphWidth, graphWidth = graphWidth,
logViewModel = logViewModel, logViewModel = logViewModel,
@ -479,7 +478,7 @@ fun GraphList(
} }
} }
items(items = commitList) { graphNode -> items(items = commitList, key = { it.name }) { graphNode ->
val nodeColor = colors[graphNode.lane.position % colors.size] val nodeColor = colors[graphNode.lane.position % colors.size]
Row( Row(