From 7e1356b6212a8c18d2232a81c83a6d11c0db2e1f Mon Sep 17 00:00:00 2001 From: Thibaut Valentin Date: Fri, 19 Dec 2025 16:13:37 +0100 Subject: [PATCH] fix: cm auto ask new category on empty competition --- src/main/webapp/src/pages/competition/editor/CMAdmin.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/src/pages/competition/editor/CMAdmin.jsx b/src/main/webapp/src/pages/competition/editor/CMAdmin.jsx index 8b2665b..8c56854 100644 --- a/src/main/webapp/src/pages/competition/editor/CMAdmin.jsx +++ b/src/main/webapp/src/pages/competition/editor/CMAdmin.jsx @@ -67,6 +67,9 @@ function CategoryHeader({cat, setCatId}) { useEffect(() => { if (cats && cats.length > 0 && !cat) { setCatId(cats.sort((a, b) => a.name.localeCompare(b.name))[0].id); + } else if (cats && cats.length === 0) { + setModal({}); + bthRef.current.click(); } }, [cats]); @@ -77,7 +80,6 @@ function CategoryHeader({cat, setCatId}) { } else { // New category setModal({}); bthRef.current.click(); - console.log(cat); e.target.value = cat?.id; } }