diff --git a/src/app/dashboard/fuel/fuel-view.tsx b/src/app/dashboard/fuel/fuel-view.tsx index 2411c74..8542ed9 100644 --- a/src/app/dashboard/fuel/fuel-view.tsx +++ b/src/app/dashboard/fuel/fuel-view.tsx @@ -311,10 +311,14 @@ export function FuelView({ // eslint-disable-next-line no-alert window.alert(err instanceof Error ? err.message : "Save failed"); }, - wireMap: (changes) => ({ - ...changes, - unit_type: (changes as Record).unitType ?? (changes as Record).unit_type, - }), + wireMap: (changes) => { + const wire: Record = { ...(changes as Record) }; + if ("unitType" in wire) { + wire.unit_type = wire.unitType; + delete wire.unitType; + } + return wire; + }, }); function handleToggle() { diff --git a/src/app/dashboard/plant/plant-view.tsx b/src/app/dashboard/plant/plant-view.tsx index a545356..2e80c18 100644 --- a/src/app/dashboard/plant/plant-view.tsx +++ b/src/app/dashboard/plant/plant-view.tsx @@ -157,10 +157,14 @@ export function PlantView({ // eslint-disable-next-line no-alert window.alert(err instanceof Error ? err.message : "Save failed"); }, - wireMap: (changes) => ({ - ...changes, - unit_type: (changes as Record).unitType ?? (changes as Record).unit_type, - }), + wireMap: (changes) => { + const wire: Record = { ...(changes as Record) }; + if ("unitType" in wire) { + wire.unit_type = wire.unitType; + delete wire.unitType; + } + return wire; + }, }); function handleToggle() {