From 1103d6f8186ab6048cbcb90f71ae310bb5d48dd2 Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Mon, 30 Mar 2026 16:09:29 -0400 Subject: [PATCH] fix: suppress all external API calls in library-only mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../explore-album-details/explore-album-details.ts | 8 ++++++++ frontend/src/components/explore-view/explore-view.ts | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/explore-album-details/explore-album-details.ts b/frontend/src/components/explore-album-details/explore-album-details.ts index 414bbbc..1de64cd 100644 --- a/frontend/src/components/explore-album-details/explore-album-details.ts +++ b/frontend/src/components/explore-album-details/explore-album-details.ts @@ -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), diff --git a/frontend/src/components/explore-view/explore-view.ts b/frontend/src/components/explore-view/explore-view.ts index 548a578..d17d06f 100644 --- a/frontend/src/components/explore-view/explore-view.ts +++ b/frontend/src/components/explore-view/explore-view.ts @@ -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 — ` +