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
This commit is contained in:
@@ -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<DarkWatchState>()(
|
||||
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<DarkWatchState>()(
|
||||
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 });
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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<VoicePrintState>()(
|
||||
|
||||
addProfile: async (name: string, relationship: string) => {
|
||||
const newProfile: VoiceProfile = {
|
||||
id: uuidv4(),
|
||||
id: randomUUID(),
|
||||
name,
|
||||
relationship,
|
||||
enrolledAt: new Date().toISOString(),
|
||||
|
||||
Reference in New Issue
Block a user