Fix: Type safety and unit validation

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 15:05:50 +00:00
parent bcba0a4f0c
commit 65a6ed1acb
10 changed files with 146 additions and 32 deletions

View File

@@ -556,8 +556,8 @@ export function extractChangedFields<T extends Record<string, any>>(
// ═══ SPECIAL HANDLING: LOCATION OBJECTS ═══
// Location can be an object (from form) vs location_id (from DB)
if (key === 'location' && newValue && typeof newValue === 'object') {
const oldLoc = originalData.location as any;
if (!oldLoc || !isEqual(oldLoc, newValue)) {
const oldLoc = originalData.location;
if (!oldLoc || typeof oldLoc !== 'object' || !isEqual(oldLoc, newValue)) {
changes[key as keyof T] = newValue;
}
return;