fix: version 4.2.2 -- Equipos ya no da falso conflicto al guardar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Milton Gonzalez
2026-10-26 16:28:26 -05:00
parent 664d111faf
commit 544928d04a
5 changed files with 16 additions and 5 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "project-linkedcorp-frontend",
"private": true,
"version": "4.2.1",
"version": "4.2.2",
"type": "module",
"scripts": {
"dev": "vite",
+6 -2
View File
@@ -56,6 +56,10 @@ function SimpleTable({ columns, rows, empty }) {
);
}
// Valores editables del equipo; el mismo formato para `initial` y para `fetchCurrent` (incluida
// editVersion: si falta en uno de los dos, las huellas nunca coinciden y todo guardado da conflicto).
const toForm = (d) => ({ status: d.status, assignedUserId: d.assigned_user_id || '', departmentId: d.department_id || '', notes: d.notes || '', editVersion: d.edit_version });
function DeviceDetail({ id, onClose, onChanged, canEdit, tab = 'general', onTabChange }) {
const { t, pushToast } = useUi();
const runAction = useAction();
@@ -69,7 +73,7 @@ function DeviceDetail({ id, onClose, onChanged, canEdit, tab = 'general', onTabC
// Borrador de los datos editables del equipo (estado, asignado, departamento, notas).
const draft = useDraftForm({
formId: 'device-edit', entityId: id,
initial: device ? { status: device.status, assignedUserId: device.assigned_user_id || '', departmentId: device.department_id || '', notes: device.notes || '', editVersion: device.edit_version } : {},
initial: device ? toForm(device) : {},
label: `${t('eq_detail')}: ${device?.hostname || id}`, enabled: !!device && canEdit && tab === 'general', onDiscard: () => setEditing(false),
});
const form = draft.values;
@@ -99,7 +103,7 @@ function DeviceDetail({ id, onClose, onChanged, canEdit, tab = 'general', onTabC
await reload();
onChanged();
pushToast({ tone: 'success', message: t('common_saved') });
}), { fetchCurrent: async () => { const d = await getDevice(id); return { status: d.status, assignedUserId: d.assigned_user_id || '', departmentId: d.department_id || '', notes: d.notes || '' }; } });
}), { fetchCurrent: async () => toForm(await getDevice(id)) });
}
if (!device) return <div className="text-muted">{t('common_loading')}</div>;