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:
@@ -289,7 +289,6 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) {
|
|||||||
aoffRef,
|
aoffRef,
|
||||||
absRef,
|
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).
|
// Start playback when the detail arrives (resume from the saved position unless already watched).
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -370,7 +369,7 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) {
|
|||||||
video.removeEventListener("canplay", syncPlaying);
|
video.removeEventListener("canplay", syncPlaying);
|
||||||
video.removeEventListener("seeked", syncPlaying);
|
video.removeEventListener("seeked", syncPlaying);
|
||||||
};
|
};
|
||||||
}, [id, patchPrefs]);
|
}, [id]);
|
||||||
|
|
||||||
// Periodic + on-unmount progress checkpoint (interval flush + pause/pagehide + reopen cache patch).
|
// Periodic + on-unmount progress checkpoint (interval flush + pause/pagehide + reopen cache patch).
|
||||||
usePlexProgress({ id, qc, videoRef, absRef, durationRef });
|
usePlexProgress({ id, qc, videoRef, absRef, durationRef });
|
||||||
|
|||||||
Reference in New Issue
Block a user