From f609fcee02cd3de9cde2aa4f94fc054d1865a58a Mon Sep 17 00:00:00 2001 From: cynfria Date: Tue, 21 Jul 2026 12:59:57 -0700 Subject: [PATCH] Keep avatar preview visible during upload (#2237) Signed-off-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Logan Johnson --- .../onboarding/ui/CommunityOnboardingFlow.tsx | 11 +- .../profile/avatarPresentationStore.ts | 174 ++++++++++++++ .../src/features/profile/ui/ProfileAvatar.tsx | 26 +- .../profile/ui/ProfileAvatarEditor.helpers.ts | 79 ++++++ .../profile/ui/ProfileAvatarEditor.tsx | 58 ++--- .../profile/ui/ProfileAvatarUploadPreview.tsx | 23 ++ .../src/features/profile/useAvatarUpload.ts | 8 +- desktop/tests/e2e/onboarding.spec.ts | 225 +++++++++++++++++- 8 files changed, 563 insertions(+), 41 deletions(-) create mode 100644 desktop/src/features/profile/avatarPresentationStore.ts create mode 100644 desktop/src/features/profile/ui/ProfileAvatarEditor.helpers.ts create mode 100644 desktop/src/features/profile/ui/ProfileAvatarUploadPreview.tsx diff --git a/desktop/src/features/onboarding/ui/CommunityOnboardingFlow.tsx b/desktop/src/features/onboarding/ui/CommunityOnboardingFlow.tsx index fabd7eef8..050aad96d 100644 --- a/desktop/src/features/onboarding/ui/CommunityOnboardingFlow.tsx +++ b/desktop/src/features/onboarding/ui/CommunityOnboardingFlow.tsx @@ -13,6 +13,7 @@ import { takePendingWelcomeChannelForDirectEntry, WELCOME_SURFACE_READY_EVENT, } from "@/features/onboarding/welcome"; +import { useAvatarPresentation } from "@/features/profile/avatarPresentationStore"; import { profileQueryKey } from "@/features/profile/hooks"; import { ProfileAvatar } from "@/features/profile/ui/ProfileAvatar"; import { @@ -80,7 +81,9 @@ function AvatarCircle({ triggerRef?: React.Ref; }) { const emojiAvatar = parseEmojiAvatarDataUrl(avatarUrl); - const hasAvatar = avatarUrl.trim().length > 0; + const presentation = useAvatarPresentation(avatarUrl); + const hasAvatar = + avatarUrl.trim().length > 0 && presentation?.state !== "failed"; return (