From 15aee9eb4e69c3ad222e9eb83b22841381eb08be Mon Sep 17 00:00:00 2001 From: saltrafael Date: Tue, 24 Aug 2021 07:03:13 -0300 Subject: [PATCH] Remove countdown on Lists --- ui/component/autoplayCountdown/view.jsx | 40 ++++++++++++++----------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/ui/component/autoplayCountdown/view.jsx b/ui/component/autoplayCountdown/view.jsx index 5b8df4bd3..31f2cc4bd 100644 --- a/ui/component/autoplayCountdown/view.jsx +++ b/ui/component/autoplayCountdown/view.jsx @@ -88,26 +88,30 @@ function AutoplayCountdown(props: Props) { // Update countdown timer. React.useEffect(() => { - let interval; - if (!timerCanceled && nextRecommendedUri) { - if (isTimerPaused) { - clearInterval(interval); - setTimer(countdownTime); - } else { - interval = setInterval(() => { - const newTime = timer - 1; - if (newTime === 0) { - doNavigate(); - } else { - setTimer(timer - 1); - } - }, 1000); + if (collectionId) { + doNavigate(); + } else { + let interval; + if (!timerCanceled && nextRecommendedUri) { + if (isTimerPaused) { + clearInterval(interval); + setTimer(countdownTime); + } else { + interval = setInterval(() => { + const newTime = timer - 1; + if (newTime === 0) { + doNavigate(); + } else { + setTimer(timer - 1); + } + }, 1000); + } } + return () => { + clearInterval(interval); + }; } - return () => { - clearInterval(interval); - }; - }, [timer, doNavigate, navigateUrl, push, timerCanceled, isTimerPaused, nextRecommendedUri]); + }, [timer, doNavigate, navigateUrl, push, timerCanceled, isTimerPaused, nextRecommendedUri, collectionId]); if (timerCanceled || !nextRecommendedUri) { return null;