fix: instant search via frontend library cache — no Go calls at all

The HTTP endpoint approach still crashed due to Wails asset server
issues. Replaced with a pure frontend solution: searchLibraryCache()
does a substring match against the libraryStore's cached artists and
albums arrays. This is pure JS — zero Go calls, zero RPC, zero
network — guaranteed instant.

Results appear immediately as the user types. The full MB+LB search
pipeline still runs via Wails RPC and replaces the library matches
with richer results when done.

Added cachedArtists/cachedAlbums getters to LibraryStore for
synchronous read-only access to the already-loaded data.
Removed the /api/search-local HTTP handler from the backend.
This commit is contained in:
2026-03-29 18:02:59 -04:00
parent 33d42febf1
commit 1999fdb0f4
4 changed files with 73 additions and 59 deletions
+10
View File
@@ -120,6 +120,16 @@ class LibraryStore {
// Returns cached data or fetches from backend on first access.
// ===================================================================
/** Synchronous access to cached artists (null if not yet loaded). */
get cachedArtists(): library.Artist[] | null {
return this.artists;
}
/** Synchronous access to cached albums (null if not yet loaded). */
get cachedAlbums(): library.Album[] | null {
return this.albums;
}
async getTracks(): Promise<library.Track[]> {
if (this.tracks !== null) {
return this.tracks;