forked from Keelrleek/SoulStream
albums: one page for every record, and streamed history rows that actually open
Three things were wrong with opening an album, and only one of them was the one that got reported. The reported half: clicking a local record in the sidebar's history went to the old in-library album view. Local albums carry no catalog identity of any kind -- `albums.mbid` is null and is not even in the DTO -- so there was nothing to route with. openAlbumByName already existed for exactly this (the now-playing links use it, and it requires BOTH artist and title to match normalized, which is the namesake guard); it now reports whether it resolved and caches settled answers, so a second click is instant. The unreported half, and the reason "half of them are not working": every STREAMED row was dead. catalog_album_id is TEXT in SQLite, so it arrives as a string, and `catalog_album` takes a u64 -- the invoke was rejected outright with "invalid type: string ... expected u64". Terrestrials, OK Human and 9 all failed silently on click. The id is coerced in checkedAlbumPayload now, where both other string sources (page seeds) pass through too. And the part that made the first half unfixable: a record no catalog carries had nowhere to go. Panda Bear's "A ? of WHEN" is not on Deezer, so no amount of resolving would ever open it. Local albums now render on the SAME page, composed from the library's own data -- its tracks, durations, bitrates and the cover already on disk -- under a namespaced `lib:` id that can never collide with a Deezer one. Playback stays local: Play and any row queue the files you already have rather than sending a record you own back through the resolver. Save is not offered (it is already saved), previews are absent (there is nothing to preview), and the attribution footer credits your library rather than claiming Deezer + MusicBrainz. With that, the old view has no callers and is deleted: the album-page block, its CSS, and the members that only it used. Nothing anywhere routes to it. Verified live: all six history rows open the new page, a Home card opens it, Play queues 14 local FLACs without streaming, and the back arrow returns.
This commit is contained in:
1 parent
3c5bccf1b6
commit
dde8c7510b
9 files changed
+252
-365
No files matched your search
+15
-2
@@ -33,13 +33,26 @@ const checkedArtistIdentity = (artistId, artist) =>
|
||||
return payload;
|
||||
});
|
||||
|
||||
const checkedAlbumPayload = (albumId) =>
|
||||
invoke("catalog_album", { albumId }).then((payload) => {
|
||||
// The id is COERCED to a number here, not merely passed along. Deezer album
|
||||
// ids reach the frontend as strings from two places — SQLite stores the
|
||||
// recently-played anchor as TEXT, and page seeds carry `String(id)` — and the
|
||||
// Rust command takes a u64, so a string argument is rejected outright with
|
||||
// "invalid type: string … expected u64". That made every streamed row in the
|
||||
// sidebar's history dead on click (2026-08-01). The identity check below still
|
||||
// compares through `sameArtistId`, which normalizes both sides, so a numeric
|
||||
// id and its string form remain the same album.
|
||||
const checkedAlbumPayload = (albumId) => {
|
||||
const numeric = typeof albumId === "number" ? albumId : Number(String(albumId).trim());
|
||||
if (!Number.isFinite(numeric)) {
|
||||
return Promise.reject(new Error(`catalog_album: not an album id: ${albumId}`));
|
||||
}
|
||||
return invoke("catalog_album", { albumId: numeric }).then((payload) => {
|
||||
if (!sameArtistId(payload?.album?.id, albumId)) {
|
||||
throw new Error("catalog_album returned a mismatched album identity");
|
||||
}
|
||||
return payload;
|
||||
});
|
||||
};
|
||||
|
||||
export const appStatus = () => invoke("app_status");
|
||||
export const getCredentials = () => invoke("get_credentials");
|
||||
|
||||
Reference in new issue
Block a user