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) { if (!store.s.realtimeMode) {
useInterval(async () => { useInterval(async () => {
const isTop = isHeadVisible(rootEl.value, 16); const isTop = rootEl.value == null ? false : isHeadVisible(rootEl.value, 16);
paginator.fetchNewer({ paginator.fetchNewer({
toQueue: !isTop, toQueue: !isTop,
}); });

View File

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

View File

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

View File

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