From 64b70073ecab29dcd4764f52be1c991d8a4ff26a Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Sun, 17 May 2026 11:12:44 -0400 Subject: [PATCH] Fix uuid dependency and silent error swallowing FRE-4572 - Replace uuid package with expo-crypto randomUUID (already a dependency) - Add error logging to darkWatchStore refreshExposures catch block - TypeScript compiles clean --- packages/mobile/src/store/darkWatchStore.ts | 8 +++++--- packages/mobile/src/store/voicePrintStore.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/mobile/src/store/darkWatchStore.ts b/packages/mobile/src/store/darkWatchStore.ts index 0d8f758..839ebe1 100644 --- a/packages/mobile/src/store/darkWatchStore.ts +++ b/packages/mobile/src/store/darkWatchStore.ts @@ -1,7 +1,7 @@ import { create } from 'zustand'; import { persist, createJSONStorage } from 'zustand/middleware'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import { v4 as uuidv4 } from 'uuid'; +import { randomUUID } from 'expo-crypto'; import type { WatchListItem, Exposure } from '@/types'; /** @@ -29,7 +29,7 @@ export const useDarkWatchStore = create()( addWatchItem: async (item) => { const newItem: WatchListItem = { ...item, - id: uuidv4(), + id: randomUUID(), lastChecked: new Date().toISOString(), }; set((state) => ({ watchList: [...state.watchList, newItem] })); @@ -52,8 +52,10 @@ export const useDarkWatchStore = create()( refreshExposures: async () => { set({ isLoading: true }); try { + // TODO: Wire to @shieldai/mobile-api-client for production set({ isLoading: false }); - } catch { + } catch (error) { + console.error('[DarkWatch] Failed to refresh exposures:', error); set({ isLoading: false }); } }, diff --git a/packages/mobile/src/store/voicePrintStore.ts b/packages/mobile/src/store/voicePrintStore.ts index 6901adf..096c9ac 100644 --- a/packages/mobile/src/store/voicePrintStore.ts +++ b/packages/mobile/src/store/voicePrintStore.ts @@ -1,7 +1,7 @@ import { create } from 'zustand'; import { persist, createJSONStorage } from 'zustand/middleware'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import { v4 as uuidv4 } from 'uuid'; +import { randomUUID } from 'expo-crypto'; import type { VoiceProfile, VoiceAnalysis } from '@/types'; /** @@ -30,7 +30,7 @@ export const useVoicePrintStore = create()( addProfile: async (name: string, relationship: string) => { const newProfile: VoiceProfile = { - id: uuidv4(), + id: randomUUID(), name, relationship, enrolledAt: new Date().toISOString(),