refactor(player): E.42 — migrate playerStore re-exports to direct imports (#607)

Migrates ~74 call sites away from the playerStore re-export shims that
were kept during M0–E.41 to avoid touching 30+ imports per PR. Now
that the bigger refactor work is done, each helper goes back to its
real home:

- `initAudioListeners`, `installQueueUndoHotkey`, `flushPlayQueuePosition`
  → from their own store modules
- `getPlaybackProgressSnapshot`, `subscribePlaybackProgress`,
  `PlaybackProgressSnapshot` → from `playbackProgress`
- `resolveReplayGainDb`, `shuffleArray`, `songToTrack`
  → from `utils/*`
- `_resetQueueUndoStacksForTest`, `consumePendingQueueListScrollTop`,
  `registerQueueListScrollTopReader` → from `queueUndo`
- `PlayerState`, `Track` types → from `playerStoreTypes`

Drops the corresponding 13 re-export stubs from `playerStore.ts` and
the now-unused imports. Also drops dead section banners + per-wrapper
comments above one-line action delegates. Trims one stale "(separate
PR)" note in `transportLightActions.ts` since that follow-up landed
in E.39.

`playerStore.ts`: 180 → 112 LOC (−68). Down from Phase E's starting
3732 LOC.

`bootstrap.test.ts` mock target updated from `../store/playerStore`
to `../store/queueUndoHotkey` to keep the spy reachable after the
import change.
This commit is contained in:
Frank Stellmacher
2026-05-12 22:46:13 +02:00
committed by GitHub
parent e92535a5f5
commit 9fac6eb490
81 changed files with 155 additions and 236 deletions
+1 -1
View File
@@ -1,3 +1,4 @@
import { initAudioListeners } from '../store/initAudioListeners';
import { lazy, Suspense, useEffect, useState } from 'react';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { invoke } from '@tauri-apps/api/core';
@@ -10,7 +11,6 @@ import ZipDownloadOverlay from '../components/ZipDownloadOverlay';
import FpsOverlay from '../components/FpsOverlay';
import { useAuthStore } from '../store/authStore';
import { useGlobalShortcutsStore } from '../store/globalShortcutsStore';
import { initAudioListeners } from '../store/playerStore';
import { initHotCachePrefetch } from '../hotCachePrefetch';
import { initMiniPlayerBridgeOnMain } from '../utils/miniPlayerBridge';
import { IS_WINDOWS } from '../utils/platform';
+5 -7
View File
@@ -1,3 +1,7 @@
import { flushPlayQueuePosition } from '../store/queueSync';
import { shuffleArray } from '../utils/shuffleArray';
import { songToTrack } from '../utils/songToTrack';
import { getPlaybackProgressSnapshot } from '../store/playbackProgress';
import { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { listen } from '@tauri-apps/api/event';
@@ -14,13 +18,7 @@ import {
} from '../api/subsonic';
import i18n from '../i18n';
import { switchActiveServer } from '../utils/switchActiveServer';
import {
usePlayerStore,
getPlaybackProgressSnapshot,
songToTrack,
shuffleArray,
flushPlayQueuePosition,
} from '../store/playerStore';
import { usePlayerStore } from '../store/playerStore';
import { useKeybindingsStore, buildInAppBinding } from '../store/keybindingsStore';
import { useGlobalShortcutsStore } from '../store/globalShortcutsStore';
import { useZipDownloadStore } from '../store/zipDownloadStore';
+2 -2
View File
@@ -6,13 +6,14 @@
* payload) and the failure-tolerant path (no throw when invoke or storage
* misbehaves).
*/
import { installQueueUndoHotkey } from '../store/queueUndoHotkey';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
vi.mock('@tauri-apps/api/core', () => ({
invoke: vi.fn(),
}));
vi.mock('../store/playerStore', () => ({
vi.mock('../store/queueUndoHotkey', () => ({
installQueueUndoHotkey: vi.fn(),
}));
@@ -21,7 +22,6 @@ vi.mock('./windowKind', () => ({
}));
import { invoke } from '@tauri-apps/api/core';
import { installQueueUndoHotkey } from '../store/playerStore';
import { getWindowKind } from './windowKind';
import {
pushLoggingModeToBackend,
+1 -1
View File
@@ -1,5 +1,5 @@
import { installQueueUndoHotkey } from '../store/queueUndoHotkey';
import { invoke } from '@tauri-apps/api/core';
import { installQueueUndoHotkey } from '../store/playerStore';
import { getWindowKind } from './windowKind';
/** Sync backend HTTP User-Agent from the main webview once at startup. */