@@ -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,6 +12,7 @@ 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 ( )
1516
1617 const state = ref < PaginatorState > ( isHydrated . value ? 'idle' : 'loading' )
1718 const items = ref < U [ ] > ( [ ] )
@@ -74,7 +75,7 @@ export function usePaginator<T, P, U = T>(
7475
7576 state . value = 'loading'
7677 try {
77- const result = await paginator . values ( ) . next ( )
78+ const result = await paginator . next ( )
7879
7980 if ( ! result . done && result . value . length ) {
8081 const preprocessedItems = preprocess ( [ ...nextItems . value , ...result . value ] as ( U | T ) [ ] )
0 commit comments