mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
fix(home): Discover Songs covers for local-index tracks (#874)
* fix(home): pre-warm and prefetch Discover Songs row covers The Discover Songs raблин. il came out of the cover pipeline merge with two gaps that left its cards stuck on the placeholder disc icon on cold caches. - `warmHomeMainstageCovers` walked `heroAlbums` / `recent` / `random` through `ensureAlbumCoverMisses` + `predecodeWarmAlbums` but skipped `discoverSongs`, so songs that were peeked but missed on disk had to wait for lazy per-card ensure - `Home.tsx`'s `coverPrefetchRegister` lumped `songRefs` into a `cappedRest` slice already saturated by 48 album refs + 16 artist refs at a 24-entry cap, so the song row's background prefetch was discarded entirely Fix: ensure + decode-warm the Discover Songs cells alongside the album rails, and register the song refs in their own bucket with a sane cap and `middle` priority. Both follow the same shape as the working album rails — no behavior change for surfaces that were already painting. * fix(library): resolve track cover art from albumId for local index songs Discover Songs uses runLocalRandomSongs; trackToSong only mapped coverArtId, so rows with empty cover_art_id but a valid album_id showed the disc placeholder. Mirror Rust COALESCE(cover_art_id, album_id) and Live Search's coverArt ?? albumId in trackToSong, SongCard, and Home prefetch. * docs(release): note Discover Songs cover fix in CHANGELOG and credits (PR #874) * docs(release): credit PR #874 to Psychotoxical and cucadmuh jointly * chore(credits): drop PR #874 from settingsCredits — minor fix --------- Co-authored-by: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com>
This commit is contained in:
+14
-2
@@ -110,15 +110,27 @@ export default function Home() {
|
||||
a.coverArt ? [coverArtRef(a.coverArt)] : [],
|
||||
);
|
||||
const artistRefs = randomArtists.map(a => coverArtRef(coverArtIdFromArtist(a)));
|
||||
const songRefs = discoverSongs.flatMap(s => (s.coverArt ? [coverArtRef(s.coverArt)] : []));
|
||||
const songRefs = discoverSongs.flatMap(s => {
|
||||
const id = s.coverArt ?? s.albumId;
|
||||
return id ? [coverArtRef(id)] : [];
|
||||
});
|
||||
const unregHero = coverPrefetchRegister(heroRefs, { surface: 'dense', priority: 'high' });
|
||||
const unregRecent = coverPrefetchRegister(recentRefs, { surface: 'dense', priority: 'high' });
|
||||
const cappedRest = [...restAlbumRefs, ...artistRefs, ...songRefs].slice(0, 24);
|
||||
// The album-and-artist `cappedRest` bucket is sized for the visible album
|
||||
// rails (random + mostPlayed + recentlyPlayed + starred = 48 refs, plus
|
||||
// 16 artist refs) and would otherwise crowd `songRefs` out entirely at
|
||||
// the 24-entry slice. Register the Discover Songs rail on its own with
|
||||
// its own modest cap so the song row gets a fair share of background
|
||||
// bandwidth without inflating the 'low' bucket.
|
||||
const cappedRest = [...restAlbumRefs, ...artistRefs].slice(0, 24);
|
||||
const unregRest = coverPrefetchRegister(cappedRest, { surface: 'dense', priority: 'low' });
|
||||
const cappedSongs = songRefs.slice(0, 16);
|
||||
const unregSongs = coverPrefetchRegister(cappedSongs, { surface: 'dense', priority: 'middle' });
|
||||
return () => {
|
||||
unregHero();
|
||||
unregRecent();
|
||||
unregRest();
|
||||
unregSongs();
|
||||
};
|
||||
}, [heroAlbums, recent, random, mostPlayed, recentlyPlayed, starred, randomArtists, discoverSongs]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user