fix: suppress all external API calls in library-only mode
Audit found three leaks: 1. explore-view: loadThumbnails() and loadArtistImages() fired on library search results. These call GetThumbnails (Wails RPC to Cover Art Archive proxy) and GetArtistImageURL (MB/Wikidata). Now skipped in library-only mode — library results already have local cover art and artist images from the library store. 2. explore-album-details: always called LookupReleaseGroup (MB) and BrowseReleases (MB) regardless of mode. Now skips both in library-only mode — shows only cache-hydrated header with no version selector or track listing. 3. explore-artist-details was already correct — the library-only branch skips all external calls.
This commit is contained in:
@@ -426,6 +426,14 @@ export class ExploreAlbumDetails extends LitElement {
|
||||
console.log(`[explore-album] hydrated from cache: "${cached.title}"`);
|
||||
}
|
||||
|
||||
// Library-only mode: no external API calls.
|
||||
if (exploreSettings.libraryOnly) {
|
||||
this.loadingInfo = false;
|
||||
this.loadingReleases = false;
|
||||
console.log(`[explore-album] loaded (library-only): "${this.albumName}"`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Phase 1: API calls for full data.
|
||||
const [infoResult, releasesResult] = await Promise.allSettled([
|
||||
this.fetchReleaseGroup(mbid),
|
||||
|
||||
@@ -597,8 +597,12 @@ export class ExploreView extends LitElement {
|
||||
localResults.artists || [],
|
||||
localResults.releaseGroups || [],
|
||||
);
|
||||
this.loadThumbnails();
|
||||
this.loadArtistImages();
|
||||
// In library-only mode, local results already have cover art
|
||||
// and artist images from the library store — no API calls needed.
|
||||
if (!exploreSettings.libraryOnly) {
|
||||
this.loadThumbnails();
|
||||
this.loadArtistImages();
|
||||
}
|
||||
const elapsed = (performance.now() - startTime).toFixed(0);
|
||||
console.log(
|
||||
`[explore] library results: "${query}" in ${elapsed}ms — ` +
|
||||
|
||||
Reference in New Issue
Block a user