From 83db9f0c388087cbb73e0aa60312898fb86d9acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Mon, 9 Jan 2023 20:23:15 +0800 Subject: [PATCH] fix: group follow notification append current group before push a single item --- components/common/CommonPaginator.vue | 14 ++-- .../notification/NotificationPaginator.vue | 69 ++++++++----------- composables/paginator.ts | 4 +- types/index.ts | 2 +- 4 files changed, 37 insertions(+), 52 deletions(-) diff --git a/components/common/CommonPaginator.vue b/components/common/CommonPaginator.vue index 2cd07162..9e40c706 100644 --- a/components/common/CommonPaginator.vue +++ b/components/common/CommonPaginator.vue @@ -1,4 +1,4 @@ - @@ -143,12 +128,12 @@ const { formatNumber } = useHumanReadableNumber() /> diff --git a/composables/paginator.ts b/composables/paginator.ts index debdd563..3e78f0b9 100644 --- a/composables/paginator.ts +++ b/composables/paginator.ts @@ -1,11 +1,11 @@ import type { Paginator, WsEvents } from 'masto' import type { PaginatorState } from '~/types' -export function usePaginator( +export function usePaginator( paginator: Paginator, stream?: Promise, eventType: 'notification' | 'update' = 'update', - preprocess: (items: T[]) => T[] = (items: T[]) => items, + preprocess: (items: T[]) => U[] = (items: T[]) => items as unknown as U[], buffer = 10, ) { const state = ref(isMastoInitialised.value ? 'idle' : 'loading') diff --git a/types/index.ts b/types/index.ts index 2320951f..42e044d8 100644 --- a/types/index.ts +++ b/types/index.ts @@ -29,7 +29,7 @@ export type PaginatorState = 'idle' | 'loading' | 'done' | 'error' export interface GroupedNotifications { id: string - type: Exclude + type: 'grouped-follow' items: mastodon.v1.Notification[] }