From 71e80b7a7a7d551951e5e6179252cc223b5400c1 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Mon, 16 Jun 2025 16:59:13 -0400 Subject: [PATCH] Fix Failing Themes Links --- src/components/ThemeSettings/ThemesTab.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/ThemeSettings/ThemesTab.tsx b/src/components/ThemeSettings/ThemesTab.tsx index 4743d38d..e711ab2f 100644 --- a/src/components/ThemeSettings/ThemesTab.tsx +++ b/src/components/ThemeSettings/ThemesTab.tsx @@ -415,11 +415,20 @@ function ThemesTab() { } async function refreshOnlineThemes() { - const themes = await Promise.all(settings.themeLinks.map(async link => { - const css = await fetch(link).then(res => res.text()); - return { ...getThemeInfo(css, link), link }; - })); - setOnlineThemes(themes); + const themes = await Promise.all( + settings.themeLinks.map(async link => { + try { + const res = await fetch(link); + if (!res.ok) throw new Error(`Failed to fetch ${link}`); + const css = await res.text(); + return { ...getThemeInfo(css, link), link }; + } catch (err) { + console.warn(`Theme fetch failed for ${link}:`, err); + return null; + } + }) + ); + setOnlineThemes(themes.filter(theme => theme !== null)); } function onThemeLinkEnabledChange(link: string, enabled: boolean) {