diff --git a/components/details/CO2GalvoDetail.tsx b/components/details/CO2GalvoDetail.tsx index d9926c1a..a89052c9 100644 --- a/components/details/CO2GalvoDetail.tsx +++ b/components/details/CO2GalvoDetail.tsx @@ -28,8 +28,8 @@ type Rec = { // CO₂ Galvo fixed lists lens_conf?: { id?: string | number; name?: string | null } | null; - lens_apt?: { id?: string | number; name?: string | null } | null; - lens_exp?: { id?: string | number; name?: string | null } | null; + lens_apt?: { id?: string | number; name?: string | null } | string | number | null; + lens_exp?: { id?: string | number; name?: string | null } | string | number | null; repeat_all?: number | null; @@ -74,6 +74,14 @@ export default function CO2GalvoDetail({ id, editable }: { id: string | number; } const yesNo = (v: any) => (v ? "Yes" : "No"); + // 🔧 NEW: always stringify possibly-object options for display + const optLabel = (v: any): string => { + if (v == null) return "—"; + if (typeof v === "string" || typeof v === "number") return String(v); + if (typeof v === "object") return v.name ?? (v.id != null ? String(v.id) : "—"); + return "—"; + }; + // fetch me id useEffect(() => { let alive = true; @@ -233,7 +241,7 @@ export default function CO2GalvoDetail({ id, editable }: { id: string | number; }; const DITHER_LABEL = (v: string | undefined) => (v ? v.charAt(0).toUpperCase() + v.slice(1) : "—"); - // ----- EDIT MODE (restore working behavior) ----- + // ----- EDIT MODE ----- if (editMode && rec) { const toId = (v: any) => v == null ? "" : typeof v === "object" ? (v.id ?? v.submission_id ?? "") : String(v); @@ -345,8 +353,9 @@ export default function CO2GalvoDetail({ id, editable }: { id: string | number; - - + {/* 🔧 patched to stringify */} + +