Skip to content

fix(web): use first whole character for dashboard avatar initial - #4291

Open
MinitJain wants to merge 1 commit into
CapSoftware:mainfrom
MinitJain:discovery/dashboard-avatar-first-whole-character
Open

MinitJain wants to merge 1 commit into
CapSoftware:mainfrom
MinitJain:discovery/dashboard-avatar-first-whole-character

Conversation

@MinitJain

@MinitJain MinitJain commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The dashboard avatar initial used name?.[0], which takes one UTF-16 code unit. Names starting with an emoji rendered a lone high surrogate, and names with a leading space rendered a blank initial instead of the "A" fallback.

This trims the name and takes the first code point with Array.from.

Changes

  • apps/web/app/(org)/dashboard/_components/Avatar.tsx: trim, then take the first code point; color index uses codePointAt.
  • apps/web/__tests__/unit/dashboard-avatar.test.ts: new tests for emoji names, leading whitespace, and empty/null fallback.

Verification

  • New tests: 3 passed (bunx vitest run __tests__/unit/dashboard-avatar.test.ts). The emoji and whitespace cases fail on the base commit.
  • Biome check on both files: clean.

Known limits

  • Array.from splits by code point, not grapheme. Flags, skin-tone modifiers and ZWJ sequences still show only their first code point. Intl.Segmenter would cover them; left out to keep the change small.

Screenshots

Not attached. Visible change: emoji-led names now show the emoji instead of a broken box.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Updates the dashboard avatar helper to trim names and select the first Unicode code point before uppercasing it.

  • Dashboard avatars trim names before picking the first initial.

Reviews (1) · Last reviewed commit: "fix(web): use first whole character for ..." · Reviewed by Greptile

Avatar took name?.[0], which is a single UTF-16 code unit. Names starting
with an emoji rendered a lone high surrogate, and names with a leading
space rendered a blank initial instead of the "A" fallback. Trim the name
and take the first code point instead.
@vercel
vercel Bot temporarily deployed to Preview – cap-status November 16, 2026 15:55 Inactive
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Nov 16, 2026 3:55pm UTC

This branch was previously deployed

1 inactive deployment
Preview – cap-status — fcd93f4a Deployed Nov 16, 2026 by vercel[bot]
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.

1 participant