Surrogate & grapheme
TS
open
Clerk truncate splits surrogate pairs in emoji / non-BMP characters
fix(ui): keep truncateWithEndVisible code-point-safe in short-width fallback
clerk · clerk/javascript
Symptom
Clerk UI's truncateWithEndVisible function uses substring/slice on raw code units in its short-width fallback, splitting surrogate pairs in emoji or non-BMP characters.
Minimal repro
A Clerk UI component displaying an email/name containing emoji in the short-width fallback path; the truncated string ends mid-surrogate-pair, showing '?' or garbled chars.
Fix
Use Array.from() or spread to split by code points, or use Intl.Segmenter, before truncating.