mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
refactor(player): E.7 — extract two small file-private helpers (#570)
`emitNormalizationDebug` (debug-mode trace forwarder, 15+ internal call sites) and `isInOrbitSession` (Orbit-active guard used by next() and the async fallback paths to suppress local queue extensions, 5 call sites) move into dedicated modules under src/store/. Both were file-private — no caller-side changes outside playerStore's own imports. playerStore 3434 → 3415 LOC.
This commit is contained in:
committed by
GitHub
parent
81b161a418
commit
a1d7cf330d
@@ -0,0 +1,17 @@
|
||||
import { useOrbitStore } from './orbitStore';
|
||||
|
||||
/**
|
||||
* True when the user is part of an Orbit session (any role, any phase short
|
||||
* of `idle` / `error` / `ended`). Used by `next()` and its async fallback
|
||||
* callbacks to suppress local queue-extension paths (radio top-up, infinite
|
||||
* queue, queue-exhausted refill) — those would either pop the
|
||||
* `orbitBulkGuard` modal or silently inject tracks the host didn't pick.
|
||||
* Also called inside in-flight `.then()` callbacks so a fetch scheduled
|
||||
* just before the user joined Orbit doesn't fire a `playTrack` after the
|
||||
* join.
|
||||
*/
|
||||
export function isInOrbitSession(): boolean {
|
||||
const o = useOrbitStore.getState();
|
||||
if (o.role !== 'host' && o.role !== 'guest') return false;
|
||||
return o.phase === 'active' || o.phase === 'joining' || o.phase === 'starting';
|
||||
}
|
||||
Reference in New Issue
Block a user