fix: prevent exit countdown on playback blocked

This commit is contained in:
talksik
2026-04-13 09:06:22 -07:00
parent bf6fdd15b5
commit 67091e9d13
+4 -4
View File
@@ -41,7 +41,7 @@ type PlaybackStatus = "idle" | "playing" | "ended";
function useExitCountdown( function useExitCountdown(
status: PlaybackStatus, status: PlaybackStatus,
composeActive: boolean, disabled: boolean,
onExit: () => void, onExit: () => void,
) { ) {
const [remainingMs, setRemainingMs] = useState<number | null>(null); const [remainingMs, setRemainingMs] = useState<number | null>(null);
@@ -61,7 +61,7 @@ function useExitCountdown(
// Tick the countdown down (pauses when compose is active) // Tick the countdown down (pauses when compose is active)
useEffect(() => { useEffect(() => {
if (remainingMs === null || remainingMs <= 0 || composeActive) return; if (remainingMs === null || remainingMs <= 0 || disabled) return;
const interval = setInterval(() => { const interval = setInterval(() => {
setRemainingMs((prev) => { setRemainingMs((prev) => {
@@ -72,7 +72,7 @@ function useExitCountdown(
}, EXIT_TICK_MS); }, EXIT_TICK_MS);
return () => clearInterval(interval); return () => clearInterval(interval);
}, [remainingMs !== null && remainingMs > 0, composeActive]); }, [remainingMs !== null && remainingMs > 0, disabled]);
// Navigate once countdown hits zero // Navigate once countdown hits zero
useEffect(() => { useEffect(() => {
@@ -237,7 +237,7 @@ function StreamViewInner({ path, streamParticle }: StreamViewProps) {
const exitRemainingMs = useExitCountdown( const exitRemainingMs = useExitCountdown(
status, status,
composeActive, playbackBlocked,
handleExitNavigate, handleExitNavigate,
); );