fix: cm auto ask new category on empty competition
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 10m17s

This commit is contained in:
Thibaut Valentin 2025-12-19 16:13:37 +01:00
parent b689521e56
commit 7e1356b621

View File

@ -67,6 +67,9 @@ function CategoryHeader({cat, setCatId}) {
useEffect(() => { useEffect(() => {
if (cats && cats.length > 0 && !cat) { if (cats && cats.length > 0 && !cat) {
setCatId(cats.sort((a, b) => a.name.localeCompare(b.name))[0].id); setCatId(cats.sort((a, b) => a.name.localeCompare(b.name))[0].id);
} else if (cats && cats.length === 0) {
setModal({});
bthRef.current.click();
} }
}, [cats]); }, [cats]);
@ -77,7 +80,6 @@ function CategoryHeader({cat, setCatId}) {
} else { // New category } else { // New category
setModal({}); setModal({});
bthRef.current.click(); bthRef.current.click();
console.log(cat);
e.target.value = cat?.id; e.target.value = cat?.id;
} }
} }