fix: preserve 0 values in EditPanel form inputs

This commit is contained in:
Christian Vidal Wolf
2026-04-10 12:55:47 +02:00
parent 15913706fa
commit 61daf8083f
+9 -9
View File
@@ -111,14 +111,14 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed
shortEn: row[COLUMNS.SHORT_EN] || '', shortEn: row[COLUMNS.SHORT_EN] || '',
detailsDe: row[COLUMNS.DETAILS_DE] || '', detailsDe: row[COLUMNS.DETAILS_DE] || '',
detailsEn: row[COLUMNS.DETAILS_EN] || '', detailsEn: row[COLUMNS.DETAILS_EN] || '',
innerW: row[COLUMNS.INNER_W] || '', innerW: row[COLUMNS.INNER_W] !== undefined && row[COLUMNS.INNER_W] !== null ? String(row[COLUMNS.INNER_W]) : '',
innerL: row[COLUMNS.INNER_L] || '', innerL: row[COLUMNS.INNER_L] !== undefined && row[COLUMNS.INNER_L] !== null ? String(row[COLUMNS.INNER_L]) : '',
innerH: row[COLUMNS.INNER_H] || '', innerH: row[COLUMNS.INNER_H] !== undefined && row[COLUMNS.INNER_H] !== null ? String(row[COLUMNS.INNER_H]) : '',
outerW: row[COLUMNS.OUTER_W] || '', outerW: row[COLUMNS.OUTER_W] !== undefined && row[COLUMNS.OUTER_W] !== null ? String(row[COLUMNS.OUTER_W]) : '',
outerL: row[COLUMNS.OUTER_L] || '', outerL: row[COLUMNS.OUTER_L] !== undefined && row[COLUMNS.OUTER_L] !== null ? String(row[COLUMNS.OUTER_L]) : '',
outerH: row[COLUMNS.OUTER_H] || '', outerH: row[COLUMNS.OUTER_H] !== undefined && row[COLUMNS.OUTER_H] !== null ? String(row[COLUMNS.OUTER_H]) : '',
unitsOuter: row[COLUMNS.UNITS_OUTER] || '', unitsOuter: row[COLUMNS.UNITS_OUTER] !== undefined && row[COLUMNS.UNITS_OUTER] !== null ? String(row[COLUMNS.UNITS_OUTER]) : '',
moq: row[COLUMNS.MOQ] || '', moq: row[COLUMNS.MOQ] !== undefined && row[COLUMNS.MOQ] !== null ? String(row[COLUMNS.MOQ]) : '',
}); });
const [loadingField, setLoadingField] = useState<string | null>(null); const [loadingField, setLoadingField] = useState<string | null>(null);
@@ -146,7 +146,7 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed
}; };
const colIndex = (colMap as Record<string, number>)[field as string]; const colIndex = (colMap as Record<string, number>)[field as string];
if (colIndex === undefined) return false; if (colIndex === undefined) return false;
return formData[field] !== (row[colIndex] || ''); return formData[field] !== (row[colIndex] !== undefined && row[colIndex] !== null ? String(row[colIndex]) : '');
}; };
const handleGenerate = async (field: keyof typeof formData) => { const handleGenerate = async (field: keyof typeof formData) => {