fix(desktop): keep sidebar within size limit

Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
This commit is contained in:
Cea Stapleton Cordasco
2026-08-04 20:50:38 -05:00
parent bbc942e2cd
commit ab80d19ab0
2 changed files with 16 additions and 8 deletions

View File

@@ -26,6 +26,19 @@ export function formatVerifiedUserLabel(
return chosen || verified || null;
}
export function formatVerifiedProfileLabel(
profile:
| Pick<Profile, "displayName" | "verifiedName" | "verifiedNameExpiresAt">
| 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

View File

@@ -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 =