mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
14bdcde33f
Cluster of four small mutables in two modules:
- `src/store/radioSessionState.ts` — `radioFetching` (concurrent
fetch guard) + `currentRadioArtistId` (seed artist that survives
track advances) + `radioSessionSeenIds` (dedupe set including
HISTORY_KEEP-evicted entries, fixes issue #500).
- `src/store/infiniteQueueState.ts` — `infiniteQueueFetching`
concurrent fetch guard.
Sed-driven bulk rewrite for the >35 direct-access sites. The four
`= new Set()` resets become `clearRadioSessionSeenIds()` calls and
the `setRadioArtistId` / `enqueueRadio` actions read through
`getCurrentRadioArtistId()` instead of touching the mutable directly.
15 focused tests across the two modules.
playerStore 2867 → 2865 LOC.
23 lines
689 B
TypeScript
23 lines
689 B
TypeScript
/**
|
|
* Concurrent-fetch guard for the infinite-queue feature. Stops a second
|
|
* `buildInfiniteQueueCandidates` request from running while the first
|
|
* is still pending — without it, switching tracks quickly while the
|
|
* infinite tail is loading would race two enqueue actions and the
|
|
* second would clobber the first's results.
|
|
*/
|
|
|
|
let infiniteQueueFetching = false;
|
|
|
|
export function isInfiniteQueueFetching(): boolean {
|
|
return infiniteQueueFetching;
|
|
}
|
|
|
|
export function setInfiniteQueueFetching(value: boolean): void {
|
|
infiniteQueueFetching = value;
|
|
}
|
|
|
|
/** Test-only: reset the guard. */
|
|
export function _resetInfiniteQueueStateForTest(): void {
|
|
infiniteQueueFetching = false;
|
|
}
|