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])
|
}, [species])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!detail) {
|
if (!detail) return
|
||||||
setDetailBones(new Map())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let cancelled = false
|
let cancelled = false
|
||||||
loadSvg(detail.src).then((root) => {
|
loadSvg(detail.src).then((root) => {
|
||||||
if (cancelled) return
|
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 () => {
|
return () => {
|
||||||
cancelled = true
|
cancelled = true
|
||||||
}
|
}
|
||||||
}, [detail])
|
}, [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 =
|
const activeObs =
|
||||||
activeIndex >= 0 ? report?.observations[activeIndex] : undefined
|
activeIndex >= 0 ? report?.observations[activeIndex] : undefined
|
||||||
|
|
||||||
@@ -199,7 +211,7 @@ export default function EditorRoute() {
|
|||||||
onDelete={removeObservation}
|
onDelete={removeObservation}
|
||||||
onMoveUp={moveObservationUp}
|
onMoveUp={moveObservationUp}
|
||||||
onMoveDown={moveObservationDown}
|
onMoveDown={moveObservationDown}
|
||||||
bones={bones}
|
bones={allBones}
|
||||||
speciesId={species.id}
|
speciesId={species.id}
|
||||||
pathologyPool={pathologies}
|
pathologyPool={pathologies}
|
||||||
onChange={(i, next: Observation) => updateObservation(i, next)}
|
onChange={(i, next: Observation) => updateObservation(i, next)}
|
||||||
|
|||||||
Reference in new issue
Block a user