refactor(ProcessPostUseCase, useCursorPagination, useDifferentialPosts): enhance post merging and loading states
- Introduced new methods for merging posts and comments efficiently, improving performance during data updates. - Updated loading state management in hooks to include initial loading and loading more states for better user feedback. - Refactored HomeScreen and PostDetailScreen to utilize the new loading states and merging logic, enhancing user experience during data fetching. - Improved pagination handling in useCursorPagination and useDifferentialPosts to ensure consistent data management across components.
This commit is contained in:
@@ -1557,8 +1557,8 @@ class MessageManager {
|
||||
payload: { conversationId, messages: mergedMessages, source: 'local_history' },
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
// 异步填充 sender 信息
|
||||
this.enrichMessagesWithSenderInfo(conversationId, mergedMessages);
|
||||
// 性能优化:历史分页仅对新批次做 sender 补全,避免每次扫描全量消息
|
||||
this.enrichMessagesWithSenderInfo(conversationId, formattedMessages);
|
||||
|
||||
return formattedMessages;
|
||||
}
|
||||
@@ -1593,8 +1593,8 @@ class MessageManager {
|
||||
payload: { conversationId, messages: mergedMessages, source: 'server_history' },
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
// 异步填充 sender 信息
|
||||
this.enrichMessagesWithSenderInfo(conversationId, mergedMessages);
|
||||
// 性能优化:仅对本次服务端批次做 sender 补全
|
||||
this.enrichMessagesWithSenderInfo(conversationId, serverMessages);
|
||||
|
||||
return serverMessages;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user