From 468cb4239e6ac9d3a668fde2b6415eab9372f69d Mon Sep 17 00:00:00 2001 From: Apoorva Srinivas Appadoo Date: Sun, 3 Nov 2024 19:43:24 +0100 Subject: [PATCH] fix: selected disapears when 0 --- libs/ui/common/src/lib/commandsR/Item.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/ui/common/src/lib/commandsR/Item.tsx b/libs/ui/common/src/lib/commandsR/Item.tsx index 4459995..5b59c3d 100644 --- a/libs/ui/common/src/lib/commandsR/Item.tsx +++ b/libs/ui/common/src/lib/commandsR/Item.tsx @@ -23,12 +23,12 @@ export function Item(props: Readonly) { const currentTableCart: Cart = useCarts((state) => state.carts)[props.tableNumber] || []; const updateItem = useCarts((state) => state.updateItem); - + const count = currentTableCart.find( (element) => element.shortName === props.item.shortName )?.quantity ?? 0; - + return ( ) { - {props.onTable ? `Selected: ${(props.remaining ?? 0) - props.onTable}` : ''} + {props.onTable !== undefined ? `Selected: ${(props.remaining ?? 0) - props.onTable}` : ''} @@ -74,7 +74,6 @@ export function Item(props: Readonly) { value as number ); }} - /> )}