From ab80d19ab0ac4c14d4500238f42586563e204074 Mon Sep 17 00:00:00 2001 From: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com> Date: Tue, 4 Aug 2026 20:50:38 -0500 Subject: [PATCH] fix(desktop): keep sidebar within size limit Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com> --- desktop/src/features/profile/lib/identity.ts | 13 +++++++++++++ desktop/src/features/sidebar/ui/AppSidebar.tsx | 11 +++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/desktop/src/features/profile/lib/identity.ts b/desktop/src/features/profile/lib/identity.ts index 45866ec3cd..95d9b0aeb6 100644 --- a/desktop/src/features/profile/lib/identity.ts +++ b/desktop/src/features/profile/lib/identity.ts @@ -26,6 +26,19 @@ export function formatVerifiedUserLabel( return chosen || verified || null; } +export function formatVerifiedProfileLabel( + profile: + | Pick + | null + | undefined, +): string | null { + return formatVerifiedUserLabel( + profile?.displayName, + profile?.verifiedName, + profile?.verifiedNameExpiresAt, + ); +} + /** * Deep-equal two profile lookups by value. Used to stabilise the merged * `messageProfiles` reference at the ChannelScreen boundary: the underlying diff --git a/desktop/src/features/sidebar/ui/AppSidebar.tsx b/desktop/src/features/sidebar/ui/AppSidebar.tsx index 222bb8e860..5d5c15378f 100644 --- a/desktop/src/features/sidebar/ui/AppSidebar.tsx +++ b/desktop/src/features/sidebar/ui/AppSidebar.tsx @@ -52,7 +52,7 @@ import type { } from "@/features/sidebar/ui/AppSidebar.types"; import { SidebarRelayConnectionCard } from "@/features/sidebar/ui/SidebarRelayConnectionCard"; import type { useSidebarRelayConnectionCard } from "@/features/sidebar/ui/useSidebarRelayConnectionCard"; -import { formatVerifiedUserLabel } from "@/features/profile/lib/identity"; +import { formatVerifiedProfileLabel } from "@/features/profile/lib/identity"; import { SidebarLoadingContent, useSidebarLoadingShape, @@ -479,18 +479,13 @@ export function AppSidebar({ immediate: isSelectedDirectMessage, timeoutMs: 400, }); - const resolvedProfileDisplayName = formatVerifiedUserLabel( - profile?.displayName, - profile?.verifiedName, - profile?.verifiedNameExpiresAt, - ); const { dmChannelLabels, dmParticipantsByChannelId, dmPresenceByChannelId } = useDmSidebarMetadata({ currentPubkey, directMessages, enabled: shouldLoadDmMetadata, fallbackDisplayName, - profileDisplayName: resolvedProfileDisplayName, + profileDisplayName: formatVerifiedProfileLabel(profile), }); const sortedDirectMessages = React.useMemo( () => @@ -510,7 +505,7 @@ export function AppSidebar({ streamChannels, }); const resolvedDisplayName = - resolvedProfileDisplayName || + formatVerifiedProfileLabel(profile) || fallbackDisplayName?.trim() || "Current identity"; const isCreatingAny =