mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +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,19 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { useAuthStore } from './authStore';
|
||||
|
||||
/**
|
||||
* Forward a structured normalization-pipeline trace to the Rust-side debug
|
||||
* log file when Settings → Logging is set to **Debug**. A no-op otherwise,
|
||||
* so the dozens of call sites in `playerStore` (refresh / backfill / engine
|
||||
* sync / track-switch instrumentation) carry zero cost in normal mode.
|
||||
*
|
||||
* Errors invoking the Rust command are swallowed — this is best-effort
|
||||
* instrumentation, not a playback dependency.
|
||||
*/
|
||||
export function emitNormalizationDebug(step: string, details?: Record<string, unknown>): void {
|
||||
if (useAuthStore.getState().loggingMode !== 'debug') return;
|
||||
void invoke('frontend_debug_log', {
|
||||
scope: 'normalization',
|
||||
message: JSON.stringify({ step, details }),
|
||||
}).catch(() => {});
|
||||
}
|
||||
Reference in New Issue
Block a user