From b8ed9be236258bf12712e5f576dadc9d452b2142 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 24 Jun 2026 21:50:10 -0400 Subject: [PATCH] fix: Avoid pointless `+1` on Facepile (#12823) * Avoid +1 on facepile * revert * feedback --- app/components/Facepile.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/components/Facepile.tsx b/app/components/Facepile.tsx index ca0d90f66e..c2d8f12753 100644 --- a/app/components/Facepile.tsx +++ b/app/components/Facepile.tsx @@ -37,10 +37,16 @@ function Facepile({ ...rest }: Props) { const { t } = useTranslation(); - const filtered = users.filter(Boolean).slice(-limit); + const present = users.filter(Boolean); + // A "+1" badge takes up the same space as an avatar, so when the single + // overflowing user is actually present in the list, show their avatar + // instead. Fall back to the badge when the overflow comes from a separate + // total count and the extra user isn't available to render. + const showLastInsteadOfBadge = overflow === 1 && present.length - limit === 1; + const filtered = present.slice(-(showLastInsteadOfBadge ? limit + 1 : limit)); const Component = renderAvatar; - if (overflow > 0) { + if (overflow > 0 && !showLastInsteadOfBadge) { filtered.unshift({ id: "overflow", initial: `${users.length ? "+" : ""}${overflow}`,