diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-26 11:39:23 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-26 11:39:23 +0700 |
| commit | 0a548e87febeab3d25ba7d5270b73b757f130b26 (patch) | |
| tree | 5f726f2564f6a38a871b2559d3762fb1ff2ad239 /src/lib/cart/components | |
| parent | 42fed2490fe537b46a717eafaf1b1e4a5e0a08c8 (diff) | |
fix bug on update qty cart and create quotation page
Diffstat (limited to 'src/lib/cart/components')
| -rw-r--r-- | src/lib/cart/components/Cart.jsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index d0685fe3..b0de5168 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -72,7 +72,7 @@ const Cart = () => { }, [products]) useEffect(() => { - const LoadProductSImilar = async () => { + const LoadProductSimilar = async () => { const randProductIndex = Math.floor(Math.random() * products.length) const productLoad = await productSearchApi({ query: `q=${products?.[randProductIndex].parent.name}&limit=10` @@ -80,8 +80,8 @@ const Cart = () => { setProductRecomendation(productLoad) } - if (products?.length > 0) LoadProductSImilar() - }, [products]) + if (products?.length > 0 && !productRecomendation) LoadProductSimilar() + }, [products, productRecomendation]) const updateQuantity = (value, productId, operation = '') => { let productIndex = products.findIndex((product) => product.id == productId) |
