From a3b318b4dfaaacd35defb5fb60201dc8ed32c40f Mon Sep 17 00:00:00 2001 From: William Brawner Date: Sun, 5 Mar 2023 10:38:31 -0700 Subject: [PATCH] Fix replace function Signed-off-by: William Brawner --- .../commonMain/kotlin/com/wbrawner/twigs/shared/Repository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Repository.kt b/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Repository.kt index c76476c..19dd178 100644 --- a/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Repository.kt +++ b/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Repository.kt @@ -18,7 +18,7 @@ interface Identifiable { } inline fun MutableList.replace(item: T) { - val index = indexOf(item) + val index = indexOfFirst { it.id == item.id } if (index > -1) { removeAt(index) }