refactor(plex): address /code-review on the S4a decomposition

Two behaviour-equivalent cleanups from the review:
- Drop the redundant per-render `audioRef.current = audioOrd` mirror in
  PlexPlayer: the only two setAudioOrd callers (usePlexTracks.changeAudio
  + the detail effect) already set audioRef synchronously, so the mirror
  never carried a value they hadn't written.
- Narrow the time-tracking effect deps from [id, patchPrefs] to [id];
  patchPrefs was a vestigial, unused dependency (eslint confirms [id] is
  the complete set).

The third finding (usePlayerVolume duplicating playerVolume.ts) is the
tracked R12 volume-consolidation sprint, not a review fix.
This commit is contained in:
2026-08-12 01:52:33 +02:00
parent f86313eaa9
commit 4c3ae00492
+1 -2
View File
@@ -289,7 +289,6 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) {
aoffRef,
absRef,
});
audioRef.current = audioOrd; // belt-and-suspenders mirror (changeAudio / the detail effect set it too)
// Start playback when the detail arrives (resume from the saved position unless already watched).
useEffect(() => {
@@ -370,7 +369,7 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) {
video.removeEventListener("canplay", syncPlaying);
video.removeEventListener("seeked", syncPlaying);
};
}, [id, patchPrefs]);
}, [id]);
// Periodic + on-unmount progress checkpoint (interval flush + pause/pagehide + reopen cache patch).
usePlexProgress({ id, qc, videoRef, absRef, durationRef });