Files
romm/frontend/src
Spinnich e85f2fe4ef fix(home): stop scanning the library filesystem on every home page load
The v2 home page requested GET /api/setup/library on every visit, which
walks every platform directory under the library path to count files.
That hint only exists for brand-new instances, but it fired for everyone:
17s per home page load on an 83k-game library, 38s on slower storage, and
the result was thrown away because the library wasn't empty.

The frontend watcher was wired to `isEmpty` with `immediate: true`, so it
ran during setup, before any of the page's data requests had started. All
the `fetching*` flags were still false and the stores were still empty, so
the library looked empty and the walk kicked off.

Frontend: onMounted now awaits the initial fetches and flips an
`initialLoadDone` flag. The watcher and the empty-state `v-if` both gate on
`initialLoadDone && isEmpty`, so the request and the render can no longer
disagree about whether the library is empty.

Backend: get_setup_library_info() returns early with an empty
`existing_platforms` once the database holds ROMs, since the on-disk hint is
meaningless then. Gated on ROMs alone, not platforms: platform rows with
zero ROMs are exactly the case the hint exists for, so those still walk.

Fixes #4063

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 16:34:15 +00:00
..
2026-07-25 09:49:35 -04:00
2026-07-25 22:32:51 -04:00