feat(pagination): implement cursor-based pagination across the app

Add useCursorPagination hook and update multiple screens and services
to use cursor-based pagination for better performance and consistency.

- Add useCursorPagination hook with deduplication and caching support
- Add cursor pagination types to infrastructure layer
- Refactor HomeScreen, PostDetailScreen, SearchScreen for posts/comments
- Refactor GroupMembersScreen, JoinGroupScreen for groups/members
- Refactor MessageListScreen, NotificationsScreen for messages
- Update post, message, group, comment, notification services with cursor endpoints
- Add CursorPaginationRequest/Response DTOs
- Remove deprecated OPTIMIZATION_DESIGN.md documentation
This commit is contained in:
lafay
2026-03-20 23:00:27 +08:00
parent a005fb0a15
commit 8a0aea1c59
20 changed files with 2464 additions and 2166 deletions

View File

@@ -499,6 +499,36 @@ export interface SystemUnreadCountResponse {
// 设备类型
export type DeviceType = 'ios' | 'android' | 'web';
// ==================== 游标分页相关 DTO ====================
/**
* 游标分页请求参数
*/
export interface CursorPaginationRequest {
/** 游标字符串(可选,首次请求不传) */
cursor?: string;
/** 分页方向forward 或 backward默认 forward */
direction?: 'forward' | 'backward';
/** 每页数量(默认 20最大 100 */
page_size?: number;
/** 帖子类型筛选可选recommend, follow, hot, latest */
post_type?: 'recommend' | 'follow' | 'hot' | 'latest';
}
/**
* 游标分页响应
*/
export interface CursorPaginationResponse<T> {
/** 数据项列表 */
items: T[];
/** 下一页游标 */
next_cursor: string | null;
/** 上一页游标 */
prev_cursor: string | null;
/** 是否有更多数据 */
has_more: boolean;
}
// 设备Token响应
export interface DeviceTokenResponse {
id: number;