From 5d617365c26823990f4b806919358d51785477ac Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 7 Feb 2026 02:53:43 -0600 Subject: [PATCH] fix: show changelog button provides loading state and error feedback The button previously failed silently when version was unavailable or the GitHub API request failed. Now shows loading state while fetching and a toast notification on failure. --- src/lib/components/views/SettingsView.svelte | 27 +++++++++++++++----- src/lib/i18n/locales/de.json | 4 ++- src/lib/i18n/locales/en.json | 4 ++- src/lib/i18n/locales/es.json | 4 ++- src/lib/i18n/locales/fr.json | 4 ++- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index 15ae45808..76262af8f 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -194,6 +194,7 @@ let updateResultRelease = $state(null); let isSettingsWhatsNewOpen = $state(false); let settingsWhatsNewRelease = $state(null); + let isFetchingChangelog = $state(false); // Blacklist state let blacklistCount = $state(getBlacklistCount()); @@ -298,11 +299,24 @@ async function handleShowCurrentChangelog(): Promise { const version = updatesCurrentVersion || getUpdatesCurrentVersion(); - if (!version) return; - const release = await fetchReleaseForVersion(version); - if (!release) return; - settingsWhatsNewRelease = release; - isSettingsWhatsNewOpen = true; + if (!version) { + showToast($t('settings.updates.versionUnavailable'), 'error'); + return; + } + isFetchingChangelog = true; + try { + const release = await fetchReleaseForVersion(version); + if (!release) { + showToast($t('settings.updates.changelogUnavailable'), 'error'); + return; + } + settingsWhatsNewRelease = release; + isSettingsWhatsNewOpen = true; + } catch { + showToast($t('settings.updates.changelogUnavailable'), 'error'); + } finally { + isFetchingChangelog = false; + } } function handleCloseSettingsWhatsNew(): void { @@ -2907,8 +2921,9 @@ class="connect-btn" onclick={handleShowCurrentChangelog} type="button" + disabled={isFetchingChangelog} > - {$t('actions.show')} + {isFetchingChangelog ? $t('actions.loading') : $t('actions.show')} diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 59097a713..c96b45ecf 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -696,7 +696,9 @@ "check": "Prüfen", "showWhatsNew": "Zeige Neuigkeiten beim Start einer neuen Version", "showChangelog": "Änderungsprotokoll für aktuelle Version anzeigen", - "currentVersion": "Aktuelle Version: v{version}" + "currentVersion": "Aktuelle Version: v{version}", + "versionUnavailable": "Versionsinformationen noch nicht verfügbar", + "changelogUnavailable": "Änderungsprotokoll für diese Version konnte nicht geladen werden" }, "networkCacheWarning": "Der ausgewählte Ordner befindet sich auf einem Netzlaufwerk.", "networkCacheWarningDetail": "Zwischengespeicherte Titel sind möglicherweise nicht verfügbar, wenn das Netzwerk getrennt ist oder im Offline-Modus. Bist du sicher, dass du diesen Speicherort verwenden möchtest?", diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index 8cd8e642c..19c08cc21 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -718,7 +718,9 @@ "check": "Check", "showWhatsNew": "Show what's new on new version launch", "showChangelog": "Show changelog for current version", - "currentVersion": "Current version: v{version}" + "currentVersion": "Current version: v{version}", + "versionUnavailable": "Version information not available yet", + "changelogUnavailable": "Could not load changelog for this version" }, "networkCacheWarning": "The selected folder is on a network drive.", "networkCacheWarningDetail": "Cached tracks may not be available when the network is disconnected or in offline mode. Are you sure you want to use this location?", diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 020d5c9b7..ca4e67642 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -718,7 +718,9 @@ "check": "Verificar", "showWhatsNew": "Mostrar novedades al lanzar nueva versión", "showChangelog": "Mostrar registro de cambios para la versión actual", - "currentVersion": "Versión actual: v{version}" + "currentVersion": "Versión actual: v{version}", + "versionUnavailable": "Información de versión no disponible aún", + "changelogUnavailable": "No se pudo cargar el registro de cambios para esta versión" }, "networkCacheWarning": "La carpeta seleccionada está en una unidad de red.", "networkCacheWarningDetail": "Las pistas en caché pueden no estar disponibles cuando la red esté desconectada o en modo offline. ¿Estás seguro de que quieres usar esta ubicación?", diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index 1c6ea3e09..9ef967c7e 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -696,7 +696,9 @@ "check": "Vérifier", "showWhatsNew": "Afficher les nouveautés lors du lancement de la nouvelle version", "showChangelog": "Afficher le journal des modifications pour la version actuelle", - "currentVersion": "Version actuelle : v{version}" + "currentVersion": "Version actuelle : v{version}", + "versionUnavailable": "Informations de version pas encore disponibles", + "changelogUnavailable": "Impossible de charger le journal des modifications pour cette version" }, "networkCacheWarning": "Le dossier sélectionné se trouve sur un lecteur réseau.", "networkCacheWarningDetail": "Les pistes mises en cache peuvent ne pas être disponibles lorsque le réseau est déconnecté ou en mode hors ligne. Voulez-vous vraiment utiliser cet emplacement ?",