feat: live toggle — views re-render when Library Only mode changes
All three explore components now subscribe to exploreSettings: - explore-view: re-runs the current search when toggled. In library-only mode this means instant local-only results; toggling off fires the full MB/LB pipeline. - explore-artist-details: re-runs loadAllData which branches on libraryOnly — switching modes live-swaps between the full API view and the library-only view. - explore-album-details: re-renders to pick up any mode-dependent display changes. All subscriptions are cleaned up in disconnectedCallback.
This commit is contained in:
@@ -677,11 +677,26 @@ export class ExploreArtistDetails extends LitElement {
|
||||
|
||||
/* ── Lifecycle ── */
|
||||
|
||||
private unsubSettings?: () => void;
|
||||
|
||||
override connectedCallback() {
|
||||
super.connectedCallback();
|
||||
if (this.artistMBID) {
|
||||
void this.loadAllData();
|
||||
}
|
||||
|
||||
// Re-render when library-only mode toggles.
|
||||
this.unsubSettings = exploreSettings.subscribe(() => {
|
||||
this.requestUpdate();
|
||||
if (this.artistMBID) {
|
||||
void this.loadAllData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
override disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.unsubSettings?.();
|
||||
}
|
||||
|
||||
/* ── Data Loading ── */
|
||||
|
||||
Reference in New Issue
Block a user