fix(explore): tell Lit that a track request changed something
The album page's tracklist badges read `libraryStatusFor(false, track.mbid)` at render time, which is a dependency on `downloadStore` that Lit cannot see. The page did subscribe to that store, but its callback only assigned `canDownload` and `isRequested` — neither of which a *track* request changes — so no reactive field moved and the component never re-rendered. The request was filed, the plus stayed a plus, and clicking again cancelled it. The other three hosts rendering these badges have always asked for the repaint in the same place, which is what made this one look correct on inspection. Closes #33 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -720,14 +720,28 @@ export class ExploreAlbumDetails extends LitElement implements ContextMenuHost {
|
||||
|
||||
// The download button only appears once a client is connected,
|
||||
// so this tracks the provider list rather than assuming.
|
||||
//
|
||||
// The `requestUpdate` is what makes the *tracklist's* badges
|
||||
// move. Both assignments below are reactive fields, so Lit
|
||||
// repaints when either changes — but a track request changes
|
||||
// neither: `canDownload` is about providers and `isRequested`
|
||||
// is about this album's own release group. Each row's badge
|
||||
// reads `libraryStatusFor(false, track.mbid)` at render time,
|
||||
// which is a dependency on the store that Lit cannot see, so
|
||||
// clicking one filed the request and left the plus exactly
|
||||
// where it was. The other three hosts rendering these badges
|
||||
// (`explore-artist-details`, `explore-view`, `top-results-row`)
|
||||
// have always asked for the repaint here; this one did not.
|
||||
this.downloadUnsub = downloadStore.subscribe(() => {
|
||||
this.canDownload = downloadStore.available;
|
||||
this.syncRequested();
|
||||
this.requestUpdate();
|
||||
});
|
||||
|
||||
void downloadStore.init().then(() => {
|
||||
this.canDownload = downloadStore.available;
|
||||
this.syncRequested();
|
||||
this.requestUpdate();
|
||||
});
|
||||
|
||||
void this.resolveTargetLibraryId();
|
||||
|
||||
Reference in New Issue
Block a user