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( const loadUpdates = useCallback(
({ disableIdleCheck = false } = {}) => { ({ disableIdleCheck = false } = {}) => {
if (uiState === 'loading') {
return;
}
console.log('✨ Load updates', { console.log('✨ Load updates', {
autoRefresh: snapStates.settings.autoRefresh, autoRefresh: snapStates.settings.autoRefresh,
scrollTop: scrollableRef.current?.scrollTop, scrollTop: scrollableRef.current?.scrollTop,
inBackground: inBackground(), inBackground: inBackground(),
disableIdleCheck, disableIdleCheck,
notificationsShowNew: snapStates.notificationsShowNew, notificationsShowNew: snapStates.notificationsShowNew,
uiState,
}); });
if ( if (
snapStates.settings.autoRefresh && snapStates.settings.autoRefresh &&
scrollableRef.current?.scrollTop < 16 && scrollableRef.current?.scrollTop < 16 &&
(disableIdleCheck || window.__IDLE__) && (disableIdleCheck || window.__IDLE__) &&
!inBackground() && !inBackground() &&
snapStates.notificationsShowNew && snapStates.notificationsShowNew
uiState !== 'loading'
) { ) {
setShowNew(false); setShowNew(false);
loadNotifications(true); loadNotifications(true);