Skip to content

fix(AvatarStack): count rendered children - #8795

Merged
tay1orjones merged 6 commits into
primer:mainfrom
nemo-crypto:nemo/avatar-stack-visible-count
Nov 25, 2026
Merged

tay1orjones merged 6 commits into
primer:mainfrom
nemo-crypto:nemo/avatar-stack-visible-count

Conversation

@nemo-crypto

Copy link
Copy Markdown
Contributor

Problem

AvatarStack uses React.Children.count to choose its geometry, so null and false placeholders select a multiple-avatar layout even when a single avatar is visible. Count rendered children using the same React child conversion used for size inference.

Verification

Added a Chromium regression for a single avatar with null and false children. The AvatarStack suite passed (9 tests).

@nemo-crypto
nemo-crypto requested a review from a team as a code owner November 19, 2026 06:54
@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 625826b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An optional changelog nit remains, recommending an AvatarStack: prefix and a clearer summary of the affected 3+ layout fix.

1 open issue
What changed in this PR

Fixes AvatarStack layout selection in @primer/react so null and false placeholders do not trigger a multi-avatar layout when only one avatar is visible.

Changes:

  • Counts children using the same conversion already used for size inference.
  • Adds a regression test for one avatar alongside null and false children.
  • Includes a patch changeset for the layout fix.
File Description
packages/​react/​src/​AvatarStack/​AvatarStack.tsx Uses React.Children.toArray for the layout count.
packages/​react/​src/​AvatarStack/​AvatarStack.test.tsx Verifies placeholders do not inflate the avatar count.
.changeset/​avatar-stack-visible-count.md Records the fix for a patch release.

Review effort: Max

tay1orjones and others added 2 commits November 25, 2026 12:55
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression test checks only data-avatar-count and needs computed minimum-width assertions to catch incorrect layouts when children are omitted.

1 open issue
1 resolved since last review

Review effort: Max

tay1orjones and others added 2 commits November 25, 2026 14:44
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the AvatarStack layout-count correction.

No open issues 🎉

1 resolved since last review

Review effort: Max

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the AvatarStack change to exclude null and false placeholders from layout counts.

No open issues 🎉

Review effort: Max

@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  Changes   Passed
Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

@tay1orjones
tay1orjones added this pull request to the merge queue Nov 25, 2026
Merged via the queue into primer:main with commit 7cf064c Nov 25, 2026
53 checks passed
@primer primer Bot mentioned this pull request Nov 25, 2026

This branch was successfully deployed

1 active deployment
github-pages — 625826b6 Deployed Nov 25, 2026 by tay1orjones via deploy-preview #30880
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants