This commit is contained in:
syuilo 2025-04-29 17:46:31 +09:00
parent 00b6e29a68
commit f7b243e2f6
4 changed files with 7 additions and 11 deletions

View File

@ -79,7 +79,7 @@ const POLLING_INTERVAL = 1000 * 15;
if (!store.s.realtimeMode) {
useInterval(async () => {
const isTop = isHeadVisible(rootEl.value, 16);
const isTop = rootEl.value == null ? false : isHeadVisible(rootEl.value, 16);
paginator.fetchNewer({
toQueue: !isTop,
});

View File

@ -71,10 +71,6 @@ function appearFetchMore() {
paginator.fetchOlder();
}
onMounted(() => {
paginator.init();
});
defineExpose({
paginator: paginator,
});

View File

@ -112,7 +112,7 @@ const POLLING_INTERVAL = 1000 * 15;
if (!store.s.realtimeMode) {
useInterval(async () => {
const isTop = isHeadVisible(rootEl.value, 16);
const isTop = rootEl.value == null ? false : isHeadVisible(rootEl.value, 16);
paginator.fetchNewer({
toQueue: !isTop,
});
@ -313,10 +313,6 @@ const paginator = usePagination({
ctx: paginationQuery,
});
onMounted(() => {
paginator.init();
});
onUnmounted(() => {
disconnectChannel();
});

View File

@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { computed, isRef, ref, watch } from 'vue';
import { computed, isRef, onMounted, ref, watch } from 'vue';
import * as Misskey from 'misskey-js';
import type { ComputedRef, Ref, ShallowRef } from 'vue';
import { misskeyApi } from '@/utility/misskey-api.js';
@ -178,6 +178,10 @@ export function usePagination<Ctx extends PagingCtx, T = Misskey.Endpoints[Ctx['
queue.value = [];
}
onMounted(() => {
init();
});
return {
items,
queue,