diff --git a/app/components/forms/SettingsSubmit.tsx b/app/components/forms/SettingsSubmit.tsx index 8fbaca1e..6ce0fe7b 100644 --- a/app/components/forms/SettingsSubmit.tsx +++ b/app/components/forms/SettingsSubmit.tsx @@ -91,7 +91,7 @@ function useOptions(path: string) { url = `${API}/items/laser_focus_lens?fields=id,name&limit=1000`; normalize = (rows) => rows.map((r) => ({ id: String(r.id), label: String(r.name ?? r.id) })); } else { - // SCAN LENSES (fiber, uv, co2-galvo): collection has no `name`; sort numerically by focal_length + // SCAN LENSES (fiber, uv, co2-galvo): sort numerically by focal_length url = `${API}/items/laser_scan_lens?fields=id,field_size,focal_length&limit=1000`; normalize = (rows) => { const toNum = (v: any) => { @@ -118,14 +118,17 @@ function useOptions(path: string) { const metaJson = await metaRes.json(); const rows = metaJson?.data ?? []; - // find the repeater parent (e.g. "fill_settings" / "line_settings" / "raster_settings") + // Approach 1: check nested children under the repeater parent const parent = rows.find((r: any) => r?.field === group); - const children = parent?.meta?.options?.fields || []; // Directus stores repeater children here + const children = parent?.meta?.options?.fields || []; + let child = children.find((f: any) => f?.field === field); - // find the child definition (e.g. "type", "dither") - const child = children.find((f: any) => f?.field === field); + // Approach 2: fallback to flat "group.field" entry if present + if (!child) { + const full = `${group}.${field}`; + child = rows.find((r: any) => r?.field === full); + } - // pull choices from the child interface meta const choices: any[] = child?.meta?.options?.choices || []; const mapped: Opt[] = choices.map((c: any) => ({ id: String(c.value ?? c.key ?? c.id), @@ -138,6 +141,11 @@ function useOptions(path: string) { setOpts(filtered); setLoading(false); } + return; // short-circuit: no fetch below + } else { + // unknown path → empty + setOpts([]); + setLoading(false); return; } @@ -282,10 +290,10 @@ export default function SettingsSubmit({ initialTarget }: { initialTarget?: Targ }, []); const meLabel = - (me?.username?.trim()) || - (me?.email?.trim()) || - ([me?.first_name, me?.last_name].filter(Boolean).join(" ").trim()) || - (me?.display_name?.trim()) || + me?.username?.trim() || + me?.email?.trim() || + [me?.first_name, me?.last_name].filter(Boolean).join(" ").trim() || + me?.display_name?.trim() || (me?.id ? `User ${me.id.slice(0, 8)}…${me.id.slice(-4)}` : "Unknown user"); // Options diff --git a/makearmy-app1329.zip b/makearmy-app1754.zip similarity index 84% rename from makearmy-app1329.zip rename to makearmy-app1754.zip index 787404a1..f014634b 100644 Binary files a/makearmy-app1329.zip and b/makearmy-app1754.zip differ