@@ -3,7 +3,7 @@ import type { mastodon } from 'masto'
33import type { Ref } from 'vue'
44
55export function usePaginator < T , P , U = T > (
6- _paginator : mastodon . Paginator < T [ ] , P > ,
6+ paginator : mastodon . Paginator < T [ ] , P > ,
77 stream : Ref < mastodon . streaming . Subscription | undefined > ,
88 eventType : 'update' | 'notification' = 'update' ,
99 preprocess : ( items : ( T | U ) [ ] ) => U [ ] = items => items as unknown as U [ ] ,
@@ -12,8 +12,8 @@ export function usePaginator<T, P, U = T>(
1212 // called `next` method will mutate the internal state of the variable,
1313 // and we need its initial state after HMR
1414 // so clone it
15- const paginator = _paginator . clone ( )
1615
16+ const paginatorValues = paginator . values ( )
1717 const state = ref < PaginatorState > ( isHydrated . value ? 'idle' : 'loading' )
1818 const items = ref < U [ ] > ( [ ] )
1919 const nextItems = ref < U [ ] > ( [ ] )
@@ -75,7 +75,7 @@ export function usePaginator<T, P, U = T>(
7575
7676 state . value = 'loading'
7777 try {
78- const result = await paginator . next ( )
78+ const result = await paginatorValues . next ( )
7979
8080 if ( ! result . done && result . value . length ) {
8181 const preprocessedItems = preprocess ( [ ...nextItems . value , ...result . value ] as ( U | T ) [ ] )
0 commit comments