diff --git a/components/common/CommonPaginator.vue b/components/common/CommonPaginator.vue index ee51666d..ddc236e7 100644 --- a/components/common/CommonPaginator.vue +++ b/components/common/CommonPaginator.vue @@ -11,6 +11,7 @@ const { virtualScroller = false, eventType = 'update', preprocess, + postprocess = items => items, noEndMessage = false, } = defineProps<{ paginator: Paginator @@ -19,6 +20,7 @@ const { stream?: Promise eventType?: 'notification' | 'update' preprocess?: (items: (U | T)[]) => U[] + postprocess?: (items: U[]) => U[] noEndMessage?: boolean }>() @@ -47,11 +49,18 @@ const nuxtApp = useNuxtApp() const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, $$(stream), eventType, preprocess) +const postProcessedItems = computedWithControl(() => postprocess(items.value as U[]), () => items.value) + nuxtApp.hook('elk-logo:click', () => { update() nuxtApp.$scrollToTop() }) +nuxtApp.hook('elk-timeline-home-filter:change', () => { + postProcessedItems.trigger() + nuxtApp.$scrollToTop() +}) + function createEntry(item: any) { items.value = [...items.value, preprocess?.([item]) ?? item] } @@ -73,11 +82,11 @@ defineExpose({ createEntry, removeEntry, updateEntry })