audio streaming app plyr.fm

fix: use Promise.allSettled so histogram failure doesn't break feed (#1010)

Promise.all rejects if either fetch fails at the network level,
causing the entire activity feed to show "no activity yet" when
only the histogram fetch fails. Switch to Promise.allSettled so
each fetch is handled independently.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

authored by zzstoatzz.io

Claude Opus 4.6 and committed by
GitHub
37766f9c 880fb5bc

+9 -5
+9 -5
frontend/src/routes/activity/+page.ts
··· 19 19 const empty: PageData = { events: [], next_cursor: null, has_more: false, histogram: [] }; 20 20 21 21 try { 22 - const [feedRes, histRes] = await Promise.all([ 22 + const [feedResult, histResult] = await Promise.allSettled([ 23 23 fetch(`${API_URL}/activity/`), 24 24 fetch(`${API_URL}/activity/histogram?days=7`) 25 25 ]); 26 26 27 - const feed = feedRes.ok 28 - ? await feedRes.json() 29 - : { events: [], next_cursor: null, has_more: false }; 27 + let feed = { events: [] as ActivityEvent[], next_cursor: null as string | null, has_more: false }; 28 + if (feedResult.status === 'fulfilled' && feedResult.value.ok) { 29 + feed = await feedResult.value.json(); 30 + } 30 31 31 - const histogram = histRes.ok ? (await histRes.json()).buckets : []; 32 + let histogram: ActivityHistogramBucket[] = []; 33 + if (histResult.status === 'fulfilled' && histResult.value.ok) { 34 + histogram = (await histResult.value.json()).buckets; 35 + } 32 36 33 37 return { ...feed, histogram }; 34 38 } catch (e) {