mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
refactor(player): E.24 — extract radio session + infinite-queue guards (#588)
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.
This commit is contained in:
committed by
GitHub
parent
6355946610
commit
14bdcde33f
@@ -0,0 +1,29 @@
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import {
|
||||
_resetInfiniteQueueStateForTest,
|
||||
isInfiniteQueueFetching,
|
||||
setInfiniteQueueFetching,
|
||||
} from './infiniteQueueState';
|
||||
|
||||
afterEach(() => {
|
||||
_resetInfiniteQueueStateForTest();
|
||||
});
|
||||
|
||||
describe('infiniteQueueFetching', () => {
|
||||
it('starts false', () => {
|
||||
expect(isInfiniteQueueFetching()).toBe(false);
|
||||
});
|
||||
|
||||
it('round-trips through set/get', () => {
|
||||
setInfiniteQueueFetching(true);
|
||||
expect(isInfiniteQueueFetching()).toBe(true);
|
||||
setInfiniteQueueFetching(false);
|
||||
expect(isInfiniteQueueFetching()).toBe(false);
|
||||
});
|
||||
|
||||
it('_resetInfiniteQueueStateForTest resets to false', () => {
|
||||
setInfiniteQueueFetching(true);
|
||||
_resetInfiniteQueueStateForTest();
|
||||
expect(isInfiniteQueueFetching()).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user