From 67e4402c52587caf1a0267a06fa173e681933d57 Mon Sep 17 00:00:00 2001
From: Maxime Princelle <maxime@princelle.org>
Date: Fri, 17 Dec 2021 14:44:13 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20stock=20only=201=20edit=20?=
 =?UTF-8?q?at=20a=20time?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/pages/stock.tsx | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/pages/stock.tsx b/src/pages/stock.tsx
index 78a3b5b..360d345 100644
--- a/src/pages/stock.tsx
+++ b/src/pages/stock.tsx
@@ -37,6 +37,12 @@ const Stock = () => {
   const toggleEditMode = (productId) => {
     let productsTemp = productsList;
     let product = productsTemp[productId];
+
+    // Set all product.edit in productsTemp to false
+    productsTemp.forEach((p) => {
+      p.edit = false;
+    });
+
     product.edit = product.edit === true ? false : true;
     setProductsList([...productsTemp]);
 
-- 
GitLab