Files
Psychotoxical-psysonic/src/store/orbitSession.ts
T
Frank Stellmacher a1d7cf330d 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.
2026-05-12 12:35:01 +02:00

18 lines
808 B
TypeScript

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';
}