fix: make sleep stats optional to prevent page crash
All checks were successful
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s

If stats endpoint fails, page will still load with empty stats.
This prevents 500 errors from blocking the entire sleep page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-22 08:33:28 +01:00
parent 836bc4294b
commit 9e4d6fa715

View File

@ -44,7 +44,7 @@ export default function SleepPage() {
setLoading(true)
Promise.all([
api.listSleep(30),
api.getSleepStats(7)
api.getSleepStats(7).catch(() => null) // Stats optional - don't fail if error
]).then(([sleepData, statsData]) => {
setSleep(sleepData)
setStats(statsData)