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