Fix single-word avatar initials#51
Merged
Merged
Conversation
getInitials doubled the first letter of a one-word name, so "Yann" rendered as "YY" on the blog index cards. With one name, names[0] and names[names.length - 1] are the same element; the length <= 2 early return only covered strings of two characters or fewer. Single-word names now yield one initial. Pre-computed initials like "SR" still pass through untouched, which the avatar docs rely on. The ":)" default is gone, replaced with an empty string. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for mcssdev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
minimaldesign
added a commit
that referenced
this pull request
Jul 24, 2026
Retitle the Unreleased section to 1.1.0 and add the Fixed entries for the single-word avatar initials fix (#51) and the random-function preset-env polyfill being disabled. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
getInitialsdoubled the first letter of a one-word name, so an author ofYannrendered as YY on the blog index cards (all 20 of them).With a single name,
names[0]andnames[names.length - 1]are the same array element, so the function concatenated the same character twice. ThefullName.length <= 2early return only shielded strings of two characters or fewer, soYannfell through to the two-name path.Fix
Single-word names now yield one initial. Two changes worth calling out:
length <= 2branch is kept, because the avatar docs document<Avatar>SR</Avatar>as a supported way to hand the component initials directly. Without it,SRrendered asS.":)"default is gone, replaced with an empty string.Known limitation: a two-letter single name like
Jostill returnsJO, since it is indistinguishable from pre-computed initials. Separating the two cases would need an explicit prop.Verification
Checked the rendered DOM on the dev server:
/blog: all 20 cards renderY(wasYY)./components/avatar:Sonny RollinstoSR, literalSRtoSR, image variants unaffected.🤖 Generated with Claude Code