diff options
Diffstat (limited to 'src-migrate/pages')
| -rw-r--r-- | src-migrate/pages/shop/cart/index.tsx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index cfb20284..5e3e042a 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -78,7 +78,6 @@ const CartPage = () => { setHasChanged(false) } - // Update the ref to the current cart state prevCartRef.current = cart ? [...cart.products] : null; }, [cart]); @@ -141,7 +140,7 @@ const CartPage = () => { const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => { - // Ensure that cart is not null before attempting to update + if (cart) { const updatedCart = { ...cart, @@ -151,7 +150,7 @@ const CartPage = () => { })) }; - updateCartItem(updatedCart); // Pass only valid CartProps to updateCartItem + updateCartItem(updatedCart); if(hasSelectedAll){ setIsSelectedAll(false); }else{ |
