fix(reco): Weekly rows resolve fast, cache per-week, show per-row skeletons
Discover > Recommendations Weekly Exploration/Jams kept vanishing and loaded slowly. Three root causes: - Weekly track resolution ran every track through MusicBrainz's serial 1.1s/req rate limiter (~110s for 100 tracks), so the rows never painted in practice (Fresh Releases, album-based with no MusicBrainz, returned fine). Resolve weekly tracks via fuzzy Qobuz search instead (skip_mb) -- fast and reliable for these mainstream playlists. - The external-reco cache was only initialized on the offline entry path; the two online login paths (auth.rs) never bound it, so nothing cached online (0-byte db). Initialize it there too. - Weeklies were bundled in the shared 48h results blob keyed only on auth-presence. Give them their own per-week cache (keyed by the ListenBrainz playlist mbid, 9d TTL, written only when non-empty, with a stale-fallback to the last good week) and rebuild them independently of the blob, so a transient empty build cannot hide them. Skip the 7d negative cache for weekly tracks so a throttle does not lock a row empty. Per-row skeletons: the progressive paint now marks each expected row pending at spawn and clears it as its builder resolves, so a slow row shows its own skeleton instead of silently missing. Adds [reco] diagnostics. cc
This commit is contained in:
8 files changed
+563
-48
No files matched your search
@@ -3,8 +3,11 @@
|
||||
// External-recommendations engine (Last.fm + ListenBrainz -> Qobuz). Artist /
|
||||
// album / track carousels, each with a `length > 0` self-hide gate; the
|
||||
// controller paints each row the moment its builder resolves (progressive).
|
||||
// Data lives in ExternalRecoState (crate::external_reco). Reuses the shared
|
||||
// Carousel / ArtistCarousel / SlimCarousel components.
|
||||
// Slow rows (the Weekly ListenBrainz playlists) carry a per-row `pending-*`
|
||||
// flag so they show their own skeleton while still loading instead of silently
|
||||
// missing while the fast rows are already painted. Data lives in
|
||||
// ExternalRecoState (crate::external_reco). Reuses the shared Carousel /
|
||||
// ArtistCarousel / SlimCarousel components.
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
@@ -12,7 +15,7 @@ import { ExternalRecoState } from "../state.slint";
|
||||
import { Carousel } from "Carousel.slint";
|
||||
import { SlimCarousel } from "SlimCarousel.slint";
|
||||
import { ArtistCarousel } from "ArtistCarousel.slint";
|
||||
import { HomeSkeleton } from "HomeSkeleton.slint";
|
||||
import { HomeSkeleton, SkeletonCarouselRow, SkeletonSlimRow } from "HomeSkeleton.slint";
|
||||
|
||||
export component ExternalRecoView inherits VerticalLayout {
|
||||
callback open-album(string);
|
||||
@@ -31,10 +34,25 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
|| ExternalRecoState.top-albums.albums.length > 0
|
||||
|| ExternalRecoState.top-artists.length > 0;
|
||||
|
||||
// True while ANY row is still resolving — drives whether the initial
|
||||
// full-page skeleton or the per-row skeletons are showing.
|
||||
property <bool> any-pending:
|
||||
ExternalRecoState.pending-rec-artists-common
|
||||
|| ExternalRecoState.pending-rec-artists-recent
|
||||
|| ExternalRecoState.pending-rec-albums
|
||||
|| ExternalRecoState.pending-fresh-releases
|
||||
|| ExternalRecoState.pending-weekly-exploration
|
||||
|| ExternalRecoState.pending-weekly-jams
|
||||
|| ExternalRecoState.pending-deep-cut-albums
|
||||
|| ExternalRecoState.pending-top-albums
|
||||
|| ExternalRecoState.pending-top-artists;
|
||||
|
||||
spacing: 40px;
|
||||
alignment: start;
|
||||
|
||||
if ExternalRecoState.loading && !root.any-content: HomeSkeleton { }
|
||||
// Initial full-page skeleton — only until the per-row pending flags are set
|
||||
// (or content arrives), after which the individual row skeletons take over.
|
||||
if ExternalRecoState.loading && !root.any-content && !root.any-pending: HomeSkeleton { }
|
||||
|
||||
// More like the artists you love (COMMON taste — overall top).
|
||||
if ExternalRecoState.rec-artists-common.length > 0: ArtistCarousel {
|
||||
@@ -48,6 +66,9 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.rec-artists-common.length == 0 && ExternalRecoState.pending-rec-artists-common: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Based on what you've been into lately (RECENT taste — 1-month top).
|
||||
if ExternalRecoState.rec-artists-recent.length > 0: ArtistCarousel {
|
||||
@@ -61,6 +82,9 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.rec-artists-recent.length == 0 && ExternalRecoState.pending-rec-artists-recent: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Recommended Albums (Last.fm artist top-albums, not scrobbled).
|
||||
if ExternalRecoState.rec-albums.albums.length > 0: Carousel {
|
||||
@@ -73,6 +97,9 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.rec-albums.albums.length == 0 && ExternalRecoState.pending-rec-albums: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Fresh Releases (ListenBrainz, from artists you follow).
|
||||
if ExternalRecoState.fresh-releases.albums.length > 0: Carousel {
|
||||
@@ -85,6 +112,9 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.fresh-releases.albums.length == 0 && ExternalRecoState.pending-fresh-releases: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Weekly Exploration (ListenBrainz discovery playlist).
|
||||
if ExternalRecoState.weekly-exploration.length > 0: SlimCarousel {
|
||||
@@ -98,6 +128,7 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.play-track(id);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.weekly-exploration.length == 0 && ExternalRecoState.pending-weekly-exploration: SkeletonSlimRow { }
|
||||
|
||||
// Weekly Jams (ListenBrainz familiar playlist).
|
||||
if ExternalRecoState.weekly-jams.length > 0: SlimCarousel {
|
||||
@@ -111,6 +142,7 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.play-track(id);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.weekly-jams.length == 0 && ExternalRecoState.pending-weekly-jams: SkeletonSlimRow { }
|
||||
|
||||
// Deep cuts from artists you know (Qobuz catalog albums).
|
||||
if ExternalRecoState.deep-cut-albums.albums.length > 0: Carousel {
|
||||
@@ -123,6 +155,9 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.deep-cut-albums.albums.length == 0 && ExternalRecoState.pending-deep-cut-albums: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Cold-start fallback — Qobuz editorial top albums.
|
||||
if ExternalRecoState.top-albums.albums.length > 0: Carousel {
|
||||
@@ -135,6 +170,9 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.top-albums.albums.length == 0 && ExternalRecoState.pending-top-albums: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Cold-start fallback — Qobuz editorial top artists.
|
||||
if ExternalRecoState.top-artists.length > 0: ArtistCarousel {
|
||||
@@ -148,9 +186,12 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
if ExternalRecoState.top-artists.length == 0 && ExternalRecoState.pending-top-artists: SkeletonCarouselRow {
|
||||
card-size: 180px;
|
||||
}
|
||||
|
||||
// Empty state.
|
||||
if !root.any-content && !ExternalRecoState.loading: VerticalLayout {
|
||||
// Empty state — nothing loaded, nothing pending, not loading.
|
||||
if !root.any-content && !root.any-pending && !ExternalRecoState.loading: VerticalLayout {
|
||||
spacing: 8px;
|
||||
Text {
|
||||
text: @tr("No recommendations yet");
|
||||
|
||||
Reference in new issue
Block a user