settings overhaul and reset

This commit is contained in:
makearmy 2025-10-05 18:21:33 -04:00
parent ee055b4060
commit 43c86c3ebc

View file

@ -92,14 +92,14 @@ export default function SettingsSubmit({ mode = "create", submissionId, initialV
url = `${API}/items/laser_software?fields=id,name&limit=1000&sort=name`;
} else if (path === "laser_source_co2_galvo") {
url = `${API}/items/laser_source?fields=submission_id,make,model,nm&limit=2000&sort=make,model`;
// Patched: robust numeric parsing to avoid JSX/Element inference and ensure number comparisons
// Explicitly reference the global Number to avoid the local <Number/> component shadowing it.
type Row = { submission_id?: string | number; make?: string; model?: string; nm?: string | number | null };
const toNum = (v: unknown): number | null => {
if (typeof v === "number") return Number.isFinite(v) ? v : null;
if (typeof v === "number") return globalThis.Number.isFinite(v) ? v : null;
if (typeof v === "string") {
const m = v.match(/-?\d+(\.\d+)?/);
const n = m ? Number(m[0]) : NaN;
return Number.isFinite(n) ? n : null;
const n = m ? globalThis.Number(m[0]) : NaN;
return globalThis.Number.isFinite(n) ? n : null;
}
return null;
};