Switch to double quotes and reformat codebase with Biome
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
|
||||
const STORAGE_KEY = '@paseo:recent-paths';
|
||||
const STORAGE_KEY = "@paseo:recent-paths";
|
||||
const MAX_RECENT_PATHS = 3;
|
||||
|
||||
export interface UseRecentPathsReturn {
|
||||
@@ -28,33 +28,36 @@ export function useRecentPaths(): UseRecentPathsReturn {
|
||||
setRecentPaths(parsed);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[RecentPaths] Failed to load recent paths:', error);
|
||||
console.error("[RecentPaths] Failed to load recent paths:", error);
|
||||
// Continue with empty array
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
const addRecentPath = useCallback(async (path: string) => {
|
||||
try {
|
||||
// Remove duplicates and add to front
|
||||
const filtered = recentPaths.filter((p) => p !== path);
|
||||
const updated = [path, ...filtered].slice(0, MAX_RECENT_PATHS);
|
||||
const addRecentPath = useCallback(
|
||||
async (path: string) => {
|
||||
try {
|
||||
// Remove duplicates and add to front
|
||||
const filtered = recentPaths.filter((p) => p !== path);
|
||||
const updated = [path, ...filtered].slice(0, MAX_RECENT_PATHS);
|
||||
|
||||
setRecentPaths(updated);
|
||||
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(updated));
|
||||
} catch (error) {
|
||||
console.error('[RecentPaths] Failed to save recent path:', error);
|
||||
throw error;
|
||||
}
|
||||
}, [recentPaths]);
|
||||
setRecentPaths(updated);
|
||||
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(updated));
|
||||
} catch (error) {
|
||||
console.error("[RecentPaths] Failed to save recent path:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
[recentPaths],
|
||||
);
|
||||
|
||||
const clearRecentPaths = useCallback(async () => {
|
||||
try {
|
||||
setRecentPaths([]);
|
||||
await AsyncStorage.removeItem(STORAGE_KEY);
|
||||
} catch (error) {
|
||||
console.error('[RecentPaths] Failed to clear recent paths:', error);
|
||||
console.error("[RecentPaths] Failed to clear recent paths:", error);
|
||||
throw error;
|
||||
}
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user