Fix dish deletion list flicker with stable identity/order and add regression test

This commit is contained in:
alexandrev-tibco
2026-02-26 11:06:54 +01:00
parent 37c2e01a09
commit 9f4cf7484d
5 changed files with 29 additions and 6 deletions
+11
View File
@@ -23,3 +23,14 @@ final class Dish {
self.createdAt = createdAt
}
}
extension Dish {
static func stableSortedForDisplay(_ dishes: [Dish]) -> [Dish] {
dishes.sorted { lhs, rhs in
if lhs.createdAt != rhs.createdAt {
return lhs.createdAt > rhs.createdAt
}
return lhs.id.uuidString < rhs.id.uuidString
}
}
}