mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
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>