Maybe this logic work better

This commit is contained in:
Lim Chee Aun 2023-11-04 01:12:28 +08:00
parent e0cf2e22fd
commit 8e341ff7ed

View file

@ -179,21 +179,22 @@ function Notifications({ columnMode }) {
const loadUpdates = useCallback(
({ disableIdleCheck = false } = {}) => {
if (uiState === 'loading') {
return;
}
console.log('✨ Load updates', {
autoRefresh: snapStates.settings.autoRefresh,
scrollTop: scrollableRef.current?.scrollTop,
inBackground: inBackground(),
disableIdleCheck,
notificationsShowNew: snapStates.notificationsShowNew,
uiState,
});
if (
snapStates.settings.autoRefresh &&
scrollableRef.current?.scrollTop < 16 &&
(disableIdleCheck || window.__IDLE__) &&
!inBackground() &&
snapStates.notificationsShowNew &&
uiState !== 'loading'
snapStates.notificationsShowNew
) {
setShowNew(false);
loadNotifications(true);