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:
@@ -76,8 +76,9 @@ export function useRegistry() {
|
||||
const entry = entries.find((e) => e.id === id);
|
||||
if (!entry) return;
|
||||
await updateEntry(id, { status: 'inchis' });
|
||||
if (closeLinked && entry.linkedEntryIds.length > 0) {
|
||||
for (const linkedId of entry.linkedEntryIds) {
|
||||
const linked = entry.linkedEntryIds ?? [];
|
||||
if (closeLinked && linked.length > 0) {
|
||||
for (const linkedId of linked) {
|
||||
const linked = entries.find((e) => e.id === linkedId);
|
||||
if (linked && linked.status !== 'inchis') {
|
||||
const updatedLinked: RegistryEntry = {
|
||||
|
||||
Reference in New Issue
Block a user