From cb30790fae8d1419aab0f31d28260d6a013f6c93 Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Sat, 24 Jan 2026 22:35:11 +0000 Subject: [PATCH] refactor: remove unused resetCustom function and improve localStorage error handling --- src/features/background/options/Custom.jsx | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/features/background/options/Custom.jsx b/src/features/background/options/Custom.jsx index 1853415f..f778723e 100644 --- a/src/features/background/options/Custom.jsx +++ b/src/features/background/options/Custom.jsx @@ -56,20 +56,6 @@ const CustomSettings = memo(() => { loadBackgrounds(); }, []); - const resetCustom = useCallback(async () => { - try { - await clearAllBackgrounds(); - setCustomBackground([]); - // Keep localStorage in sync - localStorage.setItem('customBackground', '[]'); - toast(variables.getMessage('toasts.reset')); - EventBus.emit('refresh', 'background'); - } catch (error) { - console.error('Error resetting backgrounds:', error); - toast(variables.getMessage('toasts.error')); - } - }, []); - const handleCustomBackground = useCallback( async (e, index) => { const result = e.target.result; @@ -89,7 +75,7 @@ const CustomSettings = memo(() => { // Store count in localStorage for backward compatibility try { localStorage.setItem('customBackground', JSON.stringify(backgrounds)); - } catch (quotaError) { + } catch (_quotaError) { // If quota exceeded, just store the count console.warn('localStorage quota exceeded, storing count only'); localStorage.setItem('customBackgroundCount', backgrounds.length.toString()); @@ -124,7 +110,7 @@ const CustomSettings = memo(() => { // Store in localStorage with quota handling try { localStorage.setItem('customBackground', JSON.stringify(backgrounds)); - } catch (quotaError) { + } catch (_quotaError) { console.warn('localStorage quota exceeded, storing count only'); localStorage.setItem('customBackgroundCount', backgrounds.length.toString()); }