Skip to content

Commit

Permalink
Update real time behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch committed Aug 14, 2024
1 parent 6403fcc commit 7b7191b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions kitchenowl/lib/cubits/shoppinglist_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ class ShoppinglistCubit extends Cubit<ShoppinglistCubitState> {
forceOffline: true,
saveTransaction: false,
);
if (state.selectedShoppinglist == null ||
data["shoppinglist"]["id"] != state.selectedShoppinglist?.id) return;
addLocally(
ShoppinglistItem.fromJson(data["item"]),
data["shoppinglist"]["id"],
);
}

Expand All @@ -77,12 +76,7 @@ class ShoppinglistCubit extends Cubit<ShoppinglistCubitState> {
forceOffline: true,
saveTransaction: false,
);
if (state.selectedShoppinglist == null ||
data["shoppinglist"]["id"] != state.selectedShoppinglist?.id ||
!state.selectedShoppinglist!.items
.map((e) => e.id)
.contains(data["item"]["id"])) return;
removeLocally(item);
removeLocally(item, data["shoppinglist"]["id"]);
}

Future<void> search(String query) => refresh(query: query);
Expand Down

0 comments on commit 7b7191b

Please sign in to comment.