mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 02:22:44 +01:00
* perf(roms)!: serve the filter dropdown values from their own endpoint GET /api/roms computed the filter dropdown lists (genres, franchises, companies, platforms and the rest) on every gallery open and every filter change. For a search they were 0.58 s of the 0.72 s of database time, almost all of it reading roms_facets, and a gallery needs none of them to show its cards. The lists now have their own request, GET /api/roms/filter-values, which the filter drawer makes when it opens. It takes the same scope parameters as the gallery (search_term, platform_ids, platforms_logic, collection_id, virtual_collection_id, smart_collection_id) and returns the same RomFiltersDict, limited to the roms the caller can see. On a 100,000 ROM MariaDB library with one API worker, a searched open falls from 0.85 s to 0.10 s. Opening the drawer pays the cost instead: 0.3 s for a search, 0.8 s for the whole library, which is no longer cached. BREAKING CHANGE: GET /api/roms no longer accepts with_filter_values and no longer returns filter_values. Use GET /api/roms/filter-values. The web client is updated in this commit. Backend: - add GET /api/roms/filter-values - remove with_filter_values, filter_values and the unscoped filter-values cache key from GET /api/roms - with_filter_values() in the handler no longer caches; the shared cache version counter stays because the id list and letter caches use it Frontend: - the gallery store no longer asks for the lists on open, refresh or scroll - fetchFilterValues() asks once per displayed result, and GalleryShell calls it when the drawer opens - the generated response type loses filter_values Tests: - remove the filter-values cache tests - read the lists from the new endpoint in the endpoint tests - check /api/roms no longer returns them, that the lists are never null, and that values of a hidden rom are left out - cover the on-demand fetch in the store tests Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * perf(roms) docstring updates * pr-ready: code-review - key the filter-values dedupe by scope, not result epoch, so filter, sort and group changes stop refetching the lists - empty another scope's lists while the new ones load, and refetch after a library change or context switch - abort an in-flight filter-values request for a superseded scope - send platform_ids in the filter-values endpoint tests and cover scope narrowing and ignored row filters - update comments that still called the filter values cached - test the drawer-open fetch in GalleryShell Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose (code-review follow-up) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify (code-review follow-up) Rename the filterValuesScope state field to filterValuesScopeKey so it no longer shares a name with the filterValuesScope() helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(roms): cache the whole-library filter values on the new endpoint GET /api/roms/filter-values computed the unscoped lists on every drawer open, a 0.8 s scan on a 100k-rom library. Serve them from the per-user versioned cache GET /api/roms used, under the same key, so only a scope (platform, collection or search) computes live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose (code-review follow-up) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(gallery): show a loading state while the filter values load The drawer's attribute dropdowns now show a spinner, and an open dropdown says Loading, while GET /api/roms/filter-values is in flight. The metadata provider and status lists are fixed and never show it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(roms): cover filter-values cache invalidation and private collections Hiding a rom after the whole-library lists are cached drops its values on the next request, and another user's private collection or smart collection yields no values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>