diff --git a/packages/frontend/src/components/MkPagination.vue b/packages/frontend/src/components/MkPagination.vue index 40f2cbaba..001567f89 100644 --- a/packages/frontend/src/components/MkPagination.vue +++ b/packages/frontend/src/components/MkPagination.vue @@ -51,7 +51,6 @@ import { i18n } from '@/i18n'; const SECOND_FETCH_LIMIT = 30; const TOLERANCE = 6; const APPEAR_MINIMUM_INTERVAL = 600; -const BACKGROUND_PAUSE_WAIT_SEC = 10; export type Paging = { endpoint: E; @@ -159,9 +158,6 @@ const scrollableElementOrHtml = $computed(() => scrollableElement ?? document.ge const visibility = useDocumentVisibility(); -const isPausingUpdateByVisibility = ref(false); -const timerForSetPause = ref(null); - const isPausingUpdateByExecutingQueue = ref(false); //#region scrolling @@ -346,10 +342,9 @@ const fetchMore = async (): Promise => { if (res.length === 0) { if (props.pagination.reversed) { - reverseConcat(res).then(() => { - more.value = false; - moreFetching.value = false; - }); + reverseConcat(res); + more.value = false; + moreFetching.value = false; } else { items.value = concatMapWithArray(items.value, res); more.value = false; @@ -357,10 +352,9 @@ const fetchMore = async (): Promise => { } } else { if (props.pagination.reversed) { - reverseConcat(res).then(() => { - more.value = true; - moreFetching.value = false; - }); + reverseConcat(res); + more.value = true; + moreFetching.value = false; } else { items.value = concatMapWithArray(items.value, res); more.value = true; @@ -425,30 +419,9 @@ const appearFetchMoreAhead = async (): Promise => { fetchMoreAppearTimeout(); }; -function visibilityChange() { - if (visibility.value === 'hidden') { - timerForSetPause.value = window.setTimeout(() => { - isPausingUpdateByVisibility.value = true; - timerForSetPause.value = null; - }, - BACKGROUND_PAUSE_WAIT_SEC * 1000); - } else { // 'visible' - if (timerForSetPause.value) { - clearTimeout(timerForSetPause.value); - timerForSetPause.value = null; - } else { - isPausingUpdateByVisibility.value = false; - if (!backed && active.value) { - executeQueue(); - } - } - } -} - onActivated(() => { nextTick(() => { active.value = true; - visibilityChange(); }); }); @@ -456,8 +429,6 @@ onDeactivated(() => { active.value = false; }); -watch(visibility, visibilityChange); - /** * 最新のものとして1つだけアイテムを追加する * ストリーミングから降ってきたアイテムはこれで追加する @@ -478,7 +449,7 @@ const prepend = (item: MisskeyEntity): void => { if (!backed) { // かなりスクロールの先頭にいる場合 if (items.value.has(item.id)) return; // 既にタイムラインにある場合は何もしない - if (isPausingUpdateByVisibility.value) { + if (visibility.value === 'hidden') { // バックグラウンドかつスクロールの先頭にいる場合は // prependQueueしつつちょっと特殊な処理を挟む… prependQueue(item); @@ -573,10 +544,6 @@ onMounted(() => { }); onBeforeUnmount(() => { - if (timerForSetPause.value) { - clearTimeout(timerForSetPause.value); - timerForSetPause.value = null; - } if (preventAppearFetchMoreTimer.value) { clearTimeout(preventAppearFetchMoreTimer.value); preventAppearFetchMoreTimer.value = null;