fix: guard against undefined fields when loading old localStorage data
Old entries in localStorage lack new fields (department, role, contactPersons, linkedEntryIds, attachments, versions, placeholders, ipAddress, vendor, model). Add null-coalescing guards to prevent client-side crashes on property access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -79,9 +79,9 @@ export function useInventory() {
|
||||
item.name.toLowerCase().includes(q) ||
|
||||
item.serialNumber.toLowerCase().includes(q) ||
|
||||
item.assignedTo.toLowerCase().includes(q) ||
|
||||
item.ipAddress.toLowerCase().includes(q) ||
|
||||
item.vendor.toLowerCase().includes(q) ||
|
||||
item.model.toLowerCase().includes(q)
|
||||
(item.ipAddress ?? '').toLowerCase().includes(q) ||
|
||||
(item.vendor ?? '').toLowerCase().includes(q) ||
|
||||
(item.model ?? '').toLowerCase().includes(q)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user