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.
This commit is contained in:
1 parent
29eb8b0d96
commit
5d617365c2
5 files changed
+30
-7
No files matched your search
@@ -194,6 +194,7 @@
|
||||
let updateResultRelease = $state<ReleaseInfo | null>(null);
|
||||
let isSettingsWhatsNewOpen = $state(false);
|
||||
let settingsWhatsNewRelease = $state<ReleaseInfo | null>(null);
|
||||
let isFetchingChangelog = $state(false);
|
||||
|
||||
// Blacklist state
|
||||
let blacklistCount = $state(getBlacklistCount());
|
||||
@@ -298,11 +299,24 @@
|
||||
|
||||
async function handleShowCurrentChangelog(): Promise<void> {
|
||||
const version = updatesCurrentVersion || getUpdatesCurrentVersion();
|
||||
if (!version) return;
|
||||
if (!version) {
|
||||
showToast($t('settings.updates.versionUnavailable'), 'error');
|
||||
return;
|
||||
}
|
||||
isFetchingChangelog = true;
|
||||
try {
|
||||
const release = await fetchReleaseForVersion(version);
|
||||
if (!release) return;
|
||||
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')}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -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?",
|
||||
|
||||
@@ -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?",
|
||||
|
||||
@@ -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?",
|
||||
|
||||
@@ -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 ?",
|
||||
|
||||
Reference in new issue
Block a user