From efe406df5bd4d5987d2b2baef33053ec842ba00f Mon Sep 17 00:00:00 2001 From: patak Date: Sun, 8 Jan 2023 17:04:26 +0100 Subject: [PATCH] feat: avoid reordering pagination border effects (#877) --- components/common/CommonPaginator.vue | 5 +++++ components/status/edit/StatusEditHistory.vue | 3 ++- components/timeline/TimelineHome.vue | 2 +- components/timeline/TimelinePaginator.vue | 5 +++-- components/timeline/TimelinePublic.vue | 2 +- components/timeline/TimelinePublicLocal.vue | 2 +- composables/paginator.ts | 8 +++++--- pages/[[server]]/@[account]/index/index.vue | 2 +- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/components/common/CommonPaginator.vue b/components/common/CommonPaginator.vue index 9d26aaba..2cd07162 100644 --- a/components/common/CommonPaginator.vue +++ b/components/common/CommonPaginator.vue @@ -10,6 +10,7 @@ const { keyProp = 'id', virtualScroller = false, eventType = 'update', + buffer = 10, preprocess, } = defineProps<{ paginator: Paginator @@ -17,6 +18,10 @@ const { virtualScroller?: boolean stream?: Promise eventType?: 'notification' | 'update' + // When preprocess is used, buffer is the number of items that will be hidden + // until the next pagination to avoid border effect between pages when reordering + // and grouping items + buffer?: number preprocess?: (items: T[]) => any[] }>() diff --git a/components/status/edit/StatusEditHistory.vue b/components/status/edit/StatusEditHistory.vue index c5d29343..2d6f2f80 100644 --- a/components/status/edit/StatusEditHistory.vue +++ b/components/status/edit/StatusEditHistory.vue @@ -13,12 +13,13 @@ const showHistory = (edit: mastodon.v1.StatusEdit) => { } const timeAgoOptions = useTimeAgoOptions() +// TODO: rework, this is only reversing the first page of edits const reverseHistory = (items: mastodon.v1.StatusEdit[]) => [...items].reverse()