From 6e3a839595100e76dda0026d550e9f47655a0d08 Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Tue, 19 May 2026 05:18:24 +0200 Subject: [PATCH] fix(editor): keep detail-popup bones available to ObservationCard after popup closes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detail bones were cleared on popup close, so zone labels reverted to raw ids (point-mpbynls5✕) once the head modal was dismissed. Now the detailBones map accumulates across opens, and a merged allBones map (main ∪ detail) is passed to ObservationList so describeZone resolves the FR label every time. Co-Authored-By: Claude --- src/app/routes/EditorRoute.tsx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/app/routes/EditorRoute.tsx b/src/app/routes/EditorRoute.tsx index 16046fa8..74a9600e 100644 --- a/src/app/routes/EditorRoute.tsx +++ b/src/app/routes/EditorRoute.tsx @@ -59,20 +59,32 @@ export default function EditorRoute() { }, [species]) useEffect(() => { - if (!detail) { - setDetailBones(new Map()) - return - } + if (!detail) return let cancelled = false loadSvg(detail.src).then((root) => { if (cancelled) return - setDetailBones(parseSvgBones(root)) + const parsed = parseSvgBones(root) + setDetailBones((prev) => { + const merged = new Map(prev) + parsed.forEach((b, id) => { + if (!merged.has(id)) merged.set(id, b) + }) + return merged + }) }) return () => { cancelled = true } }, [detail]) + const allBones = useMemo(() => { + const m = new Map(bones) + detailBones.forEach((b, id) => { + if (!m.has(id)) m.set(id, b) + }) + return m + }, [bones, detailBones]) + const activeObs = activeIndex >= 0 ? report?.observations[activeIndex] : undefined @@ -199,7 +211,7 @@ export default function EditorRoute() { onDelete={removeObservation} onMoveUp={moveObservationUp} onMoveDown={moveObservationDown} - bones={bones} + bones={allBones} speciesId={species.id} pathologyPool={pathologies} onChange={(i, next: Observation) => updateObservation(i, next)}