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(
status: PlaybackStatus,
composeActive: boolean,
disabled: boolean,
onExit: () => void,
) {
const [remainingMs, setRemainingMs] = useState<number | null>(null);
@@ -61,7 +61,7 @@ function useExitCountdown(
// Tick the countdown down (pauses when compose is active)
useEffect(() => {
if (remainingMs === null || remainingMs <= 0 || composeActive) return;
if (remainingMs === null || remainingMs <= 0 || disabled) return;
const interval = setInterval(() => {
setRemainingMs((prev) => {
@@ -72,7 +72,7 @@ function useExitCountdown(
}, EXIT_TICK_MS);
return () => clearInterval(interval);
}, [remainingMs !== null && remainingMs > 0, composeActive]);
}, [remainingMs !== null && remainingMs > 0, disabled]);
// Navigate once countdown hits zero
useEffect(() => {
@@ -237,7 +237,7 @@ function StreamViewInner({ path, streamParticle }: StreamViewProps) {
const exitRemainingMs = useExitCountdown(
status,
composeActive,
playbackBlocked,
handleExitNavigate,
);