From 4c3ae0049237ff448f90adab1a32e9ad700ffe2f Mon Sep 17 00:00:00 2001 From: npeter83 Date: Wed, 12 Aug 2026 01:52:33 +0200 Subject: [PATCH] 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. --- frontend/src/components/PlexPlayer.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/components/PlexPlayer.tsx b/frontend/src/components/PlexPlayer.tsx index c36a7f29..437bad27 100644 --- a/frontend/src/components/PlexPlayer.tsx +++ b/frontend/src/components/PlexPlayer.tsx @@ -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 });