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
+2 -2
View File
@@ -15,7 +15,7 @@ struct DishDrawerView: View {
private var filteredDishes: [Dish] {
let term = searchText.trimmingCharacters(in: .whitespacesAndNewlines)
return dishes.filter { dish in
return Dish.stableSortedForDisplay(dishes).filter { dish in
let matchesSearch = term.isEmpty || dish.name.localizedCaseInsensitiveContains(term)
let matchesUsedFilter = !hideUsedThisWeek || !usedDishIds.contains(dish.id)
return matchesSearch && matchesUsedFilter
@@ -95,7 +95,7 @@ struct DishDrawerView: View {
.buttonStyle(.plain)
LazyVStack(spacing: 8) {
ForEach(filteredDishes) { dish in
ForEach(filteredDishes, id: \.id) { dish in
DishCardView(
dish: dish,
tags: tags,