refactor(ProcessPostUseCase, useCursorPagination, useDifferentialPosts): enhance post merging and loading states
All checks were successful
Frontend CI / build-and-push-web (push) Successful in 4m57s
Frontend CI / ota-android (push) Successful in 10m48s
Frontend CI / build-android-apk (push) Successful in 52m58s

- 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:
lafay
2026-03-24 01:19:09 +08:00
parent aaf53d1c3b
commit 5c9cb6acea
11 changed files with 475 additions and 101 deletions

View File

@@ -70,6 +70,10 @@ export interface UseDifferentialPostsResult<T extends PostIdentifier> {
posts: T[];
/** 是否正在加载 */
loading: boolean;
/** 是否首屏加载 */
isInitialLoading: boolean;
/** 是否正在加载更多 */
isLoadingMore: boolean;
/** 是否正在刷新 */
refreshing: boolean;
/** 错误信息 */
@@ -514,6 +518,8 @@ export function useDifferentialPosts<T extends PostIdentifier = Post>(
return {
posts,
loading,
isInitialLoading: loading && posts.length === 0 && !refreshing,
isLoadingMore: loading && posts.length > 0 && !refreshing,
refreshing,
error,
hasMore,