refactor: standardize pagination response structure and enhance cursor handling
All checks were successful
Frontend CI / build-and-push-web (push) Successful in 5m8s
Frontend CI / ota-android (push) Successful in 11m22s
Frontend CI / build-android-apk (push) Successful in 45m46s

- Update various services and hooks to replace 'items' with 'list' for consistency in pagination responses.
- Modify PostRepository, commentService, groupService, messageService, and postService to align with the new response structure.
- Enhance cursor pagination logic in hooks and components to ensure proper handling of pagination states.
- Refactor HomeScreen, PostDetailScreen, SearchScreen, and other components to utilize the updated pagination structure.
This commit is contained in:
lafay
2026-03-23 03:58:26 +08:00
parent 88510aa6ae
commit 26ae288470
19 changed files with 312 additions and 309 deletions

View File

@@ -164,7 +164,7 @@ export const MessageListScreen: React.FC = () => {
// 【游标分页】使用 useCursorPagination hook 获取会话列表
const {
items: conversations,
list: conversationList,
isLoading,
isRefreshing,
hasMore,
@@ -453,7 +453,7 @@ export const MessageListScreen: React.FC = () => {
if (activeSearchTab === 'chat') {
const results: SearchResultItem[] = [];
for (const conv of conversations) {
for (const conv of conversationList) {
await messageManager.fetchMessages(String(conv.id));
const messages = messageManager.getMessages(String(conv.id));
const matchedMessages = messages.filter(msg => {
@@ -484,7 +484,7 @@ export const MessageListScreen: React.FC = () => {
} finally {
setIsSearching(false);
}
}, [conversations, activeSearchTab]);
}, [conversationList, activeSearchTab]);
// 搜索文本变化时触发搜索
useEffect(() => {
@@ -533,7 +533,7 @@ export const MessageListScreen: React.FC = () => {
// 合并列表数据
const listData: ConversationResponse[] = [
createSystemMessageItem(),
...conversations,
...conversationList,
];
// 总未读数
@@ -923,7 +923,7 @@ export const MessageListScreen: React.FC = () => {
</View>
</TouchableOpacity>
{isLoading && conversations.length === 0 ? (
{isLoading && conversationList.length === 0 ? (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color={colors.primary.main} />
</View>