mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-18 21:47:37 -04:00
[db] only add added repo to list, if not already there
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user