diff --git a/lib/hooks/useSearchCache.ts b/lib/hooks/useSearchCache.ts index c96aab6..baf9692 100644 --- a/lib/hooks/useSearchCache.ts +++ b/lib/hooks/useSearchCache.ts @@ -11,8 +11,6 @@ const CACHE_KEY = 'kvideo_search_cache'; const CACHE_DURATION = 10 * 60 * 1000; // 10 minutes export function useSearchCache() { - const hasLoadedCache = useRef(false); - const saveToCache = ( query: string, results: any[], @@ -53,19 +51,8 @@ export function useSearchCache() { } }; - const clearCache = () => { - try { - localStorage.removeItem(CACHE_KEY); - console.log('🗑️ Cache cleared'); - } catch (error) { - console.error('Failed to clear cache:', error); - } - }; - return { saveToCache, loadFromCache, - clearCache, - hasLoadedCache, }; } diff --git a/lib/hooks/useSourceBadges.ts b/lib/hooks/useSourceBadges.ts index a36f9f6..f53380d 100644 --- a/lib/hooks/useSourceBadges.ts +++ b/lib/hooks/useSourceBadges.ts @@ -46,11 +46,6 @@ export function useSourceBadges { - setSelectedSources(new Set()); - }, []); - // Auto-cleanup: remove selected sources that no longer exist useEffect(() => { const availableSourceIds = new Set(availableSources.map(s => s.id)); @@ -72,7 +67,5 @@ export function useSourceBadges 0, }; } diff --git a/lib/hooks/useTypeBadges.ts b/lib/hooks/useTypeBadges.ts index 5cfe3d7..3e3b0c7 100644 --- a/lib/hooks/useTypeBadges.ts +++ b/lib/hooks/useTypeBadges.ts @@ -1,6 +1,6 @@ 'use client'; -import { useState, useEffect, useMemo, useCallback, useTransition } from 'react'; +import { useState, useEffect, useMemo, useCallback } from 'react'; interface TypeBadge { type: string; @@ -19,7 +19,6 @@ interface TypeBadge { */ export function useTypeBadges(videos: T[]) { const [selectedTypes, setSelectedTypes] = useState>(new Set()); - const [isPending, startTransition] = useTransition(); // Collect and count type badges from videos const typeBadges = useMemo(() => { @@ -50,7 +49,6 @@ export function useTypeBadges(videos: T[]) { }, [videos, selectedTypes]); // Toggle type selection - useCallback to prevent re-creation - // Use startTransition to make UI feel responsive const toggleType = useCallback((type: string) => { // Update selected types immediately (high priority) setSelectedTypes(prev => { @@ -64,11 +62,6 @@ export function useTypeBadges(videos: T[]) { }); }, []); - // Clear all selections - useCallback to prevent re-creation - const clearSelection = useCallback(() => { - setSelectedTypes(new Set()); - }, []); - // Auto-cleanup: remove selected types that no longer exist in badges useEffect(() => { const availableTypes = new Set(typeBadges.map(b => b.type)); @@ -91,8 +84,5 @@ export function useTypeBadges(videos: T[]) { selectedTypes, filteredVideos, toggleType, - clearSelection, - hasFilters: selectedTypes.size > 0, - isPending, // Export pending state }; }