fix(dashboard): guard failureThreshold against empty/invalid settings values

v-model.number on the Settings input returns an empty string when cleared,
which persists through the PATCH and then coerces error_count >= '' to
error_count >= 0 — flagging every source as failing. Coerce to Number and
fall back to 5 unless the value is a finite number >= 1.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 23:53:18 -04:00
parent 42192e82be
commit f3412dea57
+5 -4
View File
@@ -354,10 +354,11 @@ let refreshInterval = null
const stats = computed(() => downloadsStore.stats)
const recentActivity = computed(() => downloadsStore.recentActivity)
// Read threshold from settings, default 5 if unset
const failureThreshold = computed(() =>
settingsStore.settings['dashboard.failure_threshold'] ?? 5
)
// Read threshold from settings, default 5 if unset or invalid
const failureThreshold = computed(() => {
const n = Number(settingsStore.settings['dashboard.failure_threshold'])
return Number.isFinite(n) && n >= 1 ? n : 5
})
// Per-platform health for platforms with ≥1 enabled source
const platformHealth = computed(() => {