From dc2eb1163fc6a6539b28eba2324e97d51253baac Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 9 Nov 2023 00:16:16 +0800 Subject: [PATCH] Slow down polling if scrolled down --- src/components/timeline.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index 830dcae0..ca2b1d59 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -282,7 +282,9 @@ function Timeline({ // checkForUpdates interval useInterval( loadOrCheckUpdates, - visible && !showNew ? checkForUpdatesInterval : null, + visible && !showNew + ? checkForUpdatesInterval * (nearReachStart ? 1 : 2) + : null, ); const hiddenUI = scrollDirection === 'end' && !nearReachStart;