fix: group follow notification

append current group before push a single item
This commit is contained in:
三咲智子 2023-01-09 20:23:15 +08:00
parent efe7d639c1
commit 83db9f0c38
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
4 changed files with 37 additions and 52 deletions

View file

@ -1,11 +1,11 @@
import type { Paginator, WsEvents } from 'masto'
import type { PaginatorState } from '~/types'
export function usePaginator<T, P>(
export function usePaginator<T, P, U = T>(
paginator: Paginator<T[], P>,
stream?: Promise<WsEvents>,
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<PaginatorState>(isMastoInitialised.value ? 'idle' : 'loading')