Slow down polling if scrolled down

This commit is contained in:
Lim Chee Aun 2023-11-09 00:16:16 +08:00
parent 469ce0df6b
commit dc2eb1163f

View file

@ -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;