diff --git a/app/settings/co2-galvo/[id]/co2-galvo.tsx b/app/settings/co2-galvo/[id]/co2-galvo.tsx index 7bbef2eb..cc0e29e5 100644 --- a/app/settings/co2-galvo/[id]/co2-galvo.tsx +++ b/app/settings/co2-galvo/[id]/co2-galvo.tsx @@ -10,7 +10,6 @@ export default function CO2GalvoSettingDetailPage() { const [setting, setSetting] = useState(null); const [loading, setLoading] = useState(true); - // claim UI state const [claimBusy, setClaimBusy] = useState(false); const [claimMsg, setClaimMsg] = useState(null); const [claimErr, setClaimErr] = useState(null); @@ -25,7 +24,7 @@ export default function CO2GalvoSettingDetailPage() { "submission_id", "setting_title", "uploader", - // ✅ fetch username directly + // ✅ request username explicitly "owner.id", "owner.username", "setting_notes", @@ -46,7 +45,7 @@ export default function CO2GalvoSettingDetailPage() { "lens_apt.name", "lens_exp.name", "focus", - // ✅ handle both shapes + // ✅ handle string-or-relation "laser_soft", "laser_soft.name", "repeat_all", @@ -68,10 +67,11 @@ export default function CO2GalvoSettingDetailPage() { if (loading) return

Loading setting...

; if (!setting) return

Setting not found.

; - // ✅ prefer username - const ownerName = (row: any) => row?.owner?.username ?? null; + // ✅ prefer username; fall back to id or uploader (just in case) + const ownerName = (row: any) => + row?.owner?.username ?? (row?.owner?.id ? String(row.owner.id) : null) ?? null; - // Render “name” if relation, or raw string if the field is plain text. + // ✅ show string or relation.name const softwareLabel = typeof setting.laser_soft === "object" ? setting.laser_soft?.name ?? "—" @@ -97,10 +97,8 @@ export default function CO2GalvoSettingDetailPage() { return (

{label}:{" "} - {typeof value === "boolean" - ? formatBoolean(value) - : value || "—"} -

+ {typeof value === "boolean" ? formatBoolean(value) : value || "—"} +

); })}