summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:11:25 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:11:25 +0900
commitf1deb89e348eb8f1a39b51e33a0ae33d59529feb (patch)
tree2e92a7a21a1bf377719e1b125a9ac44bc14a529e /packages/frontend/src/components/MkStreamingNotificationsTimeline.vue
parentfeat(backend): クリップ内でノートを検索できるように (diff)
downloadmisskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.gz
misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.bz2
misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.zip
refactor(frontend): improve pagination implementation
Diffstat (limited to 'packages/frontend/src/components/MkStreamingNotificationsTimeline.vue')
-rw-r--r--packages/frontend/src/components/MkStreamingNotificationsTimeline.vue38
1 files changed, 21 insertions, 17 deletions
diff --git a/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue b/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue
index b12effd0d1..04b230277c 100644
--- a/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue
+++ b/packages/frontend/src/components/MkStreamingNotificationsTimeline.vue
@@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { onUnmounted, onMounted, computed, useTemplateRef, TransitionGroup } from 'vue';
+import { onUnmounted, onMounted, computed, useTemplateRef, TransitionGroup, markRaw, watch } from 'vue';
import * as Misskey from 'misskey-js';
import { useInterval } from '@@/js/use-interval.js';
import type { notificationTypes } from '@@/js/const.js';
@@ -53,8 +53,8 @@ import { i18n } from '@/i18n.js';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import { prefer } from '@/preferences.js';
import { store } from '@/store.js';
-import { usePagination } from '@/composables/use-pagination.js';
import { isSeparatorNeeded, getSeparatorInfo } from '@/utility/timeline-date-separate.js';
+import { Paginator } from '@/utility/paginator.js';
const props = defineProps<{
excludeTypes?: typeof notificationTypes[number][];
@@ -62,21 +62,17 @@ const props = defineProps<{
const rootEl = useTemplateRef('rootEl');
-const paginator = usePagination({
- ctx: prefer.s.useGroupedNotifications ? {
- endpoint: 'i/notifications-grouped' as const,
- limit: 20,
- params: computed(() => ({
- excludeTypes: props.excludeTypes ?? undefined,
- })),
- } : {
- endpoint: 'i/notifications' as const,
- limit: 20,
- params: computed(() => ({
- excludeTypes: props.excludeTypes ?? undefined,
- })),
- },
-});
+const paginator = prefer.s.useGroupedNotifications ? markRaw(new Paginator('i/notifications-grouped', {
+ limit: 20,
+ computedParams: computed(() => ({
+ excludeTypes: props.excludeTypes ?? undefined,
+ })),
+})) : markRaw(new Paginator('i/notifications', {
+ limit: 20,
+ computedParams: computed(() => ({
+ excludeTypes: props.excludeTypes ?? undefined,
+ })),
+}));
const MIN_POLLING_INTERVAL = 1000 * 10;
const POLLING_INTERVAL =
@@ -116,6 +112,14 @@ function reload() {
let connection: Misskey.ChannelConnection<Misskey.Channels['main']> | null = null;
onMounted(() => {
+ paginator.init();
+
+ if (paginator.computedParams) {
+ watch(paginator.computedParams, () => {
+ paginator.reload();
+ }, { immediate: false, deep: true });
+ }
+
if (store.s.realtimeMode) {
connection = useStream().useChannel('main');
connection.on('notification', onNotification);