From b7a1e5843687fa960ab14426189b558df85e873b Mon Sep 17 00:00:00 2001 From: Thibaut Valentin Date: Sat, 27 Dec 2025 17:34:58 +0100 Subject: [PATCH] fix: cma comb dupli on poule list --- .../competition/editor/CategoryAdminContent.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/src/pages/competition/editor/CategoryAdminContent.jsx b/src/main/webapp/src/pages/competition/editor/CategoryAdminContent.jsx index b3066c5..73d349f 100644 --- a/src/main/webapp/src/pages/competition/editor/CategoryAdminContent.jsx +++ b/src/main/webapp/src/pages/competition/editor/CategoryAdminContent.jsx @@ -64,10 +64,16 @@ export function CategoryContent({cat, catId, setCat}) { reducer({type: 'UPDATE_OR_ADD', payload: {...data, c1: data.c1?.id, c2: data.c2?.id}}); combDispatch({type: 'SET_ALL', payload: {source: "match", data: [data.c1, data.c2].filter(d => d != null)}}); - if (data.c1 !== null && !groupsRef.current.some(g => g.id === data.c1?.id)) - setGroups(prev => [...prev, {id: data.c1?.id, poule: data.poule}]); - if (data.c2 !== null && !groupsRef.current.some(g => g.id === data.c2?.id)) - setGroups(prev => [...prev, {id: data.c2?.id, poule: data.poule}]); + setGroups(prev => { + if (data.c1 !== null && !prev.some(g => g.id === data.c1?.id)) + return [...prev, {id: data.c1?.id, poule: data.poule}]; + return prev; + }) + setGroups(prev => { + if (data.c2 !== null && !prev.some(g => g.id === data.c2?.id)) + return [...prev, {id: data.c2?.id, poule: data.poule}]; + return prev; + }) } }