fix: replace unguarded crypto.randomUUID() with safe generateUUID() utility

This commit is contained in:
Linus Rath
2026-04-02 14:51:21 +02:00
parent 1bdc51dcc7
commit c4673acb65
14 changed files with 38 additions and 25 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import type { ContactCard, AddressBook, ContactName } from '@/lib/jmap/types';
import type { IJMAPClient } from '@/lib/jmap/client-interface';
import { generateUUID } from '@/lib/utils';
export function getContactDisplayName(contact: ContactCard): string {
if (contact.name?.components) {
@@ -378,7 +379,7 @@ export const useContactStore = create<ContactStore>()(
set((state) => ({ contacts: [...state.contacts, created] }));
} else {
const localGroup: ContactCard = {
id: `local-${crypto.randomUUID()}`,
id: `local-${generateUUID()}`,
addressBookIds: {},
...groupData,
} as ContactCard;
@@ -617,7 +618,7 @@ export const useContactStore = create<ContactStore>()(
} else {
const localContact: ContactCard = {
...contact,
id: `local-${crypto.randomUUID()}`,
id: `local-${generateUUID()}`,
};
set((state) => ({ contacts: [...state.contacts, localContact] }));
}