diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-08-05 10:01:18 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-08-05 10:01:18 +0700 |
| commit | 213b4444c48896f24dd6803a9db2ae58af5b0391 (patch) | |
| tree | d77ae721379a1cf5b52c01e54213890c33f26cfd /src-migrate/pages | |
| parent | 865f509a8b45c6db195661f35417623572d33cea (diff) | |
<iman> update unchek cart
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{ |
