Skip to content

Commit cba94bd

Browse files
author
Bot
committed
Fix compilation: AvatarPile and smart casts
1 parent 4396b91 commit cba94bd

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

ui/src/commonMain/kotlin/dev/materii/gloom/ui/screen/repo/component/CommitItem.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ fun CommitItem(
9090
val authorAvatar = author?.avatarUrl
9191
val committerAvatar = committer?.avatarUrl
9292

93+
val avatars = buildList {
94+
authorAvatar?.let { add(it) }
95+
if (isUniqueCommiter) committerAvatar?.let { add(it) }
96+
}.toPersistentList()
97+
9398
AvatarPile(
94-
avatars = if (isUniqueCommiter) {
95-
persistentListOfNotNull(authorAvatar, committerAvatar)
96-
} else {
97-
persistentListOfNotNull(authorAvatar)
98-
}
99+
avatars = avatars
99100
)
100101

101102
Text(

ui/src/commonMain/kotlin/dev/materii/gloom/ui/screen/repo/viewmodel/RepoDetailsViewModel.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,16 @@ class RepoDetailsViewModel(
6161
// Optimistic update
6262
updateStarDetails(starred = !hasStarred)
6363

64+
val detailsId = details?.id
65+
if (detailsId == null) return
66+
6467
screenModelScope.launch {
6568
isStarLoading = true
6669

6770
if (hasStarred) {
68-
gql.unstarRepo(details.id)
71+
gql.unstarRepo(detailsId)
6972
} else {
70-
gql.starRepo(details.id)
73+
gql.starRepo(detailsId)
7174
}.ifUnsuccessful {
7275
// Revert optimistic update
7376
updateStarDetails(starred = hasStarred)

0 commit comments

Comments
 (0)