feat(pagination): add updateItem for in-place list updates and optimize notifications
Some checks failed
Frontend CI / build-and-push-web (push) Failing after 2m48s
Frontend CI / ota-android (push) Successful in 10m30s
Frontend CI / build-android-apk (push) Successful in 39m3s

Add `updateItem` function to cursor pagination hook for updating single items
without full list refresh. Use this in NotificationsScreen to mark messages
as read locally instead of refetching. Also add `is_blocked` detection in
postService and userProfile to show blocked state in profile screen.
This commit is contained in:
lafay
2026-04-25 11:26:13 +08:00
parent ad19bc2af7
commit f16f001f6c
6 changed files with 53 additions and 17 deletions

View File

@@ -47,6 +47,7 @@ export const UserProfileScreen: React.FC<UserProfileScreenProps> = ({ mode, user
handleMessage,
handleBlock,
isBlocked,
isBlockedProfile,
handleSettings,
handleEditProfile,
isCurrentUser,
@@ -54,7 +55,18 @@ export const UserProfileScreen: React.FC<UserProfileScreenProps> = ({ mode, user
} = useUserProfile({ mode, userId, isDesktop, isTablet });
// 渲染帖子列表 - Twitter 风格无边框
const renderPostList = useCallback((postList: Post[], emptyTitle: string, emptyDesc: string) => {
const renderPostList = useCallback((postList: Post[], emptyTitle: string, emptyDesc: string, blockedTitle?: string, blockedDesc?: string) => {
if (isBlockedProfile && blockedTitle) {
return (
<EmptyState
title={blockedTitle}
description={blockedDesc || ''}
icon="account-off-outline"
variant="modern"
/>
);
}
if (postList.length === 0) {
return (
<EmptyState
@@ -85,7 +97,7 @@ export const UserProfileScreen: React.FC<UserProfileScreenProps> = ({ mode, user
})}
</View>
);
}, [currentUser?.id, handlePostAction, activeTab]);
}, [currentUser?.id, handlePostAction, activeTab, isBlockedProfile]);
// 渲染内容
const renderContent = useCallback(() => {
@@ -95,7 +107,9 @@ export const UserProfileScreen: React.FC<UserProfileScreenProps> = ({ mode, user
return renderPostList(
posts,
mode === 'self' ? '还没有帖子' : '这个用户还没有发布任何帖子',
mode === 'self' ? '分享你的想法,发布第一条帖子吧' : ''
mode === 'self' ? '分享你的想法,发布第一条帖子吧' : '',
mode === 'other' ? '已将该用户拉黑' : undefined,
mode === 'other' ? '你已将此用户拉黑,不再显示其帖子' : undefined
);
}