Extra check if container if not clickable

This commit is contained in:
Lim Chee Aun 2023-11-01 18:12:22 +08:00
parent ecb1be5776
commit caeeffaa72

View file

@ -226,23 +226,28 @@ function Timeline({
const loadOrCheckUpdates = useCallback( const loadOrCheckUpdates = useCallback(
async ({ disableIdleCheck = false } = {}) => { async ({ disableIdleCheck = false } = {}) => {
console.log('✨ Load or check updates', { const noPointers = scrollableRef.current
? getComputedStyle(scrollableRef.current).pointerEvents === 'none'
: false;
console.log('✨ Load or check updates', id, {
autoRefresh: snapStates.settings.autoRefresh, autoRefresh: snapStates.settings.autoRefresh,
scrollTop: scrollableRef.current.scrollTop, scrollTop: scrollableRef.current.scrollTop,
disableIdleCheck, disableIdleCheck,
idle: window.__IDLE__, idle: window.__IDLE__,
inBackground: inBackground(), inBackground: inBackground(),
noPointers,
}); });
if ( if (
snapStates.settings.autoRefresh && snapStates.settings.autoRefresh &&
scrollableRef.current.scrollTop < 16 && scrollableRef.current.scrollTop < 16 &&
(disableIdleCheck || window.__IDLE__) && (disableIdleCheck || window.__IDLE__) &&
!inBackground() !inBackground() &&
!noPointers
) { ) {
console.log('✨ Load updates', snapStates.settings.autoRefresh); console.log('✨ Load updates', id, snapStates.settings.autoRefresh);
loadItems(true); loadItems(true);
} else { } else {
console.log('✨ Check updates', snapStates.settings.autoRefresh); console.log('✨ Check updates', id, snapStates.settings.autoRefresh);
const hasUpdate = await checkForUpdates(); const hasUpdate = await checkForUpdates();
if (hasUpdate) { if (hasUpdate) {
console.log('✨ Has new updates', id); console.log('✨ Has new updates', id);