[db] only add added repo to list, if not already there

This commit is contained in:
Torsten Grote
2026-04-13 13:40:11 -03:00
parent 4ab39c6529
commit 6822186b8b

View File

@@ -188,7 +188,13 @@ constructor(
if (addedRepo != null)
withContext(Dispatchers.Main) {
// as soon as the list has loaded, it should never be null
_repositoriesState.update { it!!.toMutableList().apply { add(addedRepo) } }
_repositoriesState.update { repos ->
if (repos!!.none { it.repoId == addedRepo.repoId }) {
repos.toMutableList().apply { add(addedRepo) }
} else {
repos
}
}
}
}
}