recents: a streamed album has no library id, so the key must not pretend it does

The sidebar history looked completely dead -- albums never appeared, the
list never updated, and often nothing was there at all. The backend was
fine the whole time: 460 play rows, recent_albums returning every album
correctly.

The list is a keyed each on `a:${album_id}`, but catalog-anchored rows --
every streamed play -- carry album_id NULL by design and are identified by
catalog_album_id. One streamed album in history keyed `a:null` harmlessly.
The second one collided with it, the keyed each threw, and the whole list
unmounted; every later refresh fed a dead component. It demoed clean
yesterday only because history had just been wiped and exactly one
streamed album existed.

Keys now carry the id realm, the same two-realm split isPlaying and
openRecent already used.
This commit is contained in:
KeelrLeek committed 2026-08-01 07:11:25 -05:00
1 parent 69f64c11eb
commit 3c5bccf1b6
1 file changed
+9 -1
+9 -1
View File
@@ -82,7 +82,15 @@
day = k;
rows.push({ kind: "day", label: k, key: `d:${k}` });
}
rows.push({ kind: "album", album: a, key: `a:${a.album_id}` });
// Two id realms, so the key must carry the realm: catalog rows
// have album_id NULL, and keying them all `a:null` was a
// duplicate-key crash that silently killed this whole list the
// moment TWO streamed albums entered history (2026-08-01).
rows.push({
kind: "album",
album: a,
key: a.kind === "catalog" ? `c:${a.catalog_album_id}` : `l:${a.album_id}`,
});
}
return rows;
});