fix(editor): keep detail-popup bones available to ObservationCard after popup closes
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
b3bd75d2e2
commit
6e3a839595
1 file changed
+18
-6
@@ -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)}
|
||||
|
||||
Reference in new issue
Block a user