Skip to content

Commit

Permalink
pos /cashier-v2 微修正
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm committed Oct 6, 2024
1 parent 0b6b653 commit c93fdff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/components/organisms/OrderItemEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,17 @@ const OrderItemEdit = ({
useEffect(() => {
if (!focus) {
setItemFocus(-1);
setEditable(false);
} else {
setItemFocus(0);
}
}, [focus]);

// itemFocus が range 外に出ないように調整
useEffect(() => {
setItemFocus((prev) => Math.min(order.items.length - 1, Math.max(0, prev)));
setItemFocus((prev) =>
Math.min(order.items.length - 1, Math.max(-1, prev)),
);
});

return (
Expand Down

0 comments on commit c93fdff

Please sign in to comment.