mirror of
https://github.com/dergigi/boris.git
synced 2026-02-17 04:54:56 +01:00
- Replace @typescript-eslint/no-explicit-any with proper Filter type from nostr-tools/filter in dataFetch.ts and helpers.ts - Replace @typescript-eslint/no-explicit-any with IAccount and AccountManager types from applesauce-accounts in hooks - Replace @typescript-eslint/no-explicit-any with unknown type casts in App.tsx for keep-alive subscription - Fix react-hooks/exhaustive-deps warnings by including all dependencies in useEffect hooks - Remove unused _settings parameters in useImageCache.ts that were causing no-unused-vars warnings
29 lines
886 B
TypeScript
29 lines
886 B
TypeScript
/**
|
|
* Hook to return image URL for display
|
|
* Service Worker handles all caching transparently
|
|
* Images are cached on first load and available offline automatically
|
|
*
|
|
* @param imageUrl - The URL of the image to display
|
|
* @returns The image URL (Service Worker handles caching)
|
|
*/
|
|
export function useImageCache(
|
|
imageUrl: string | undefined
|
|
): string | undefined {
|
|
// Service Worker handles everything - just return the URL as-is
|
|
return imageUrl
|
|
}
|
|
|
|
/**
|
|
* Pre-load image to ensure it's cached by Service Worker
|
|
* Triggers a fetch so the SW can cache it even if not visible yet
|
|
*/
|
|
export function useCacheImageOnLoad(
|
|
imageUrl: string | undefined
|
|
): void {
|
|
// Service Worker will cache on first fetch
|
|
// This hook is now a no-op, kept for API compatibility
|
|
// The browser will automatically fetch and cache images when they're used in <img> tags
|
|
void imageUrl
|
|
}
|
|
|