summaryrefslogtreecommitdiff
path: root/packages/frontend/src/composables
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-06-28 20:21:21 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-06-28 20:21:21 +0900
commitb8e8f3ad25fafbe0567e710eddfcced04deb03ad (patch)
tree4847b140ad2a7b5c5c86e5cda61af2ff7e444853 /packages/frontend/src/composables
parentenhance(frontend): improve MkTl rendering (diff)
downloadmisskey-b8e8f3ad25fafbe0567e710eddfcced04deb03ad.tar.gz
misskey-b8e8f3ad25fafbe0567e710eddfcced04deb03ad.tar.bz2
misskey-b8e8f3ad25fafbe0567e710eddfcced04deb03ad.zip
enhance: ページネーション(一覧表示)の基準日時を指定できるように sinceId/untilIdが指定可能なエンドポイントにおいて、sinceDate/untilDateも指定可能に
Diffstat (limited to 'packages/frontend/src/composables')
-rw-r--r--packages/frontend/src/composables/use-pagination.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/frontend/src/composables/use-pagination.ts b/packages/frontend/src/composables/use-pagination.ts
index ed891c0b14..4411f163af 100644
--- a/packages/frontend/src/composables/use-pagination.ts
+++ b/packages/frontend/src/composables/use-pagination.ts
@@ -34,6 +34,7 @@ export type PagingCtx<E extends keyof Misskey.Endpoints = keyof Misskey.Endpoint
offsetMode?: boolean;
initialId?: MisskeyEntity['id'];
+ initialDate?: number | null;
initialDirection?: 'newer' | 'older';
// 配列内の要素をどのような順序で並べるか
@@ -89,14 +90,18 @@ export function usePagination<Endpoint extends keyof Misskey.Endpoints, T extend
...params,
limit: props.ctx.limit ?? FIRST_FETCH_LIMIT,
allowPartial: true,
- ...(props.ctx.initialDirection === 'newer' ? {
- sinceId: props.ctx.initialId ?? '0',
- } : props.ctx.initialId && props.ctx.initialDirection === 'older' ? {
+ ...((props.ctx.initialId == null && props.ctx.initialDate == null) && props.ctx.initialDirection === 'newer' ? {
+ sinceId: '0',
+ } : props.ctx.initialDirection === 'newer' ? {
+ sinceId: props.ctx.initialId,
+ sinceDate: props.ctx.initialDate,
+ } : (props.ctx.initialId || props.ctx.initialDate) && props.ctx.initialDirection === 'older' ? {
untilId: props.ctx.initialId,
+ untilDate: props.ctx.initialDate,
} : {}),
}).then(res => {
// 逆順で返ってくるので
- if (props.ctx.initialId && props.ctx.initialDirection === 'newer') {
+ if ((props.ctx.initialId || props.ctx.initialDate) && props.ctx.initialDirection === 'newer') {
res.reverse();
}