mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
08d098d5aa
The `LOUDNESS_BACKFILL_WINDOW_AHEAD` constant, the predicate `isTrackInsideLoudnessBackfillWindow`, and the id-list collector `collectLoudnessBackfillWindowTrackIds` move into `src/store/loudnessBackfillWindow.ts`. `isTrackInsideLoudnessBackfillWindow` was rewritten to be pure — it now takes the queue / queueIndex / currentTrack as explicit parameters instead of reading `usePlayerStore.getState()` internally. The one call site in `refreshLoudnessForTrack` reads state once and passes it through. Net: zero behaviour change, clearer test surface (no store mocks), no top-level coupling back to playerStore. `prefetchLoudnessForEnqueuedTracks` stays in playerStore — it calls `refreshLoudnessForTrack` which lives there too. 13 focused tests pin the window-slides-with-queueIndex contract, the clamp at the end of the queue, the empty-input fallbacks, and the duplicate collapse when currentTrack is also in the ahead range. playerStore 3261 → 3238 LOC.