Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Decouple Space feed loading from friends

Neeraj Guptaf25223e0f3ca
diff --git a/web/apps/space/src/pages/app/index.tsx b/web/apps/space/src/pages/app/index.tsx
index 420b424729..73bc1dc444 100644
--- a/web/apps/space/src/pages/app/index.tsx
+++ b/web/apps/space/src/pages/app/index.tsx
@@ -57,8 +57,7 @@ const Page: React.FC = () => {
localFeedPosts.length == 0;
const isSkippingInitialFeedSkeleton =
isInitialFeedLoading && skipNextHomeFeedSkeleton;
- const isHomeFeedLoading =
- isFriendsLoading || (isFeedLoading && !isSkippingInitialFeedSkeleton);
+ const isHomeFeedLoading = isFeedLoading && !isSkippingInitialFeedSkeleton;
const closeFriendRequestSentToast = React.useCallback(
() => setFriendRequestSentToastName(undefined),
[],
@@ -211,6 +210,7 @@ const Page: React.FC = () => {
hasMoreFeedItems={Boolean(feedNextCursor)}
isFeedLoading={isHomeFeedLoading}
isFeedLoadingMore={isFeedLoadingMore}
+ isFriendsLoading={isFriendsLoading}
localFeedPosts={localFeedPosts}
profile={profile}
showInstallPrompt={
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index 138369171d..c98a62cc92 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -110,6 +110,7 @@ interface HomeScreenProps {
hasUnreadMessages?: boolean;
isFeedLoading?: boolean;
isFeedLoadingMore?: boolean;
+ isFriendsLoading?: boolean;
localFeedPosts?: LocalSpaceFeedPost[];
showInstallPrompt?: boolean;
onCreatePost?: (
@@ -1269,6 +1270,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
hasUnreadMessages,
isFeedLoading = false,
isFeedLoadingMore = false,
+ isFriendsLoading = false,
localFeedPosts = [],
showInstallPrompt = false,
onCreatePost,
@@ -1330,10 +1332,10 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
const isInstallPromptEnabled =
showInstallPrompt && !friendRequestSentToastName && !selectedViewer;
const showUnreadIndicator = hasUnreadMessages === true;
- const emptyFeedMessage =
- friendsCount == 0
- ? "When you add friends, their posts will appear here."
- : "When your friends share posts, they'll appear here.";
+ const hasLoadedNoFriends = !isFriendsLoading && friendsCount == 0;
+ const emptyFeedMessage = hasLoadedNoFriends
+ ? "When you add friends, their posts will appear here."
+ : "When your friends share posts, they'll appear here.";
const profileDisplayName =
profile?.fullName.trim() || profile?.username.trim() || "";
const revokeLocalPostObjectUrls = React.useCallback(() => {
@@ -2025,7 +2027,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
>
{emptyFeedMessage}
</Box>
- {friendsCount == 0 && (
+ {hasLoadedNoFriends && (
<SpaceShareInviteButton
profileLink={profileLink}
sharing={isInviteSharing}