Repository navigation
fix(mobile): keep the telling part of long account emails in Accounts - #52227
Conversation
Long Claude, Codex and Antigravity account emails were cut at the end, so two logins on one long domain could read the same and the domain was lost. Rows now cut long titles in the middle: an email keeps its name before "@" whole (what tells accounts on one domain apart) and its domain loses its middle. Desktop's middleEllipsis moves to src/shared and gains this email variant; the phone's page measures with it (native text cuts evenly itself). Toasts already wrap, so they keep showing the whole email.
[Low impact] The PR appears safe to merge; no actionable issues were found. SummaryAccounts rows now keep the email name visible and shorten the domain when space allows.
Reviews (1) · Last reviewed commit: "fix(mobile): keep the telling part of lo..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
Long account emails on the phone's Accounts screen were cut off at the end, so two accounts on the same long domain could look the same and you never saw the domain. Now the part that tells them apart, the name before "@", stays whole and the domain is shortened in the middle.
What Changed
Before: Claude, Codex and Antigravity account rows cut long emails at the end ("bartholomew.fitzgerald@northwind-industr…").
After: those row titles cut in the middle. For an email, the name before the last "@" stays whole and the domain loses its middle ("bartholomew.fitzgerald+claude-team@n…om" vs "bartholomew.fitzgerald@northwi…mple.com"). If the name alone doesn't fit, it falls back to an even middle cut. Screen readers still get the full email.
How:
middleEllipsis(text, fits)(used by the run-target picker) moves tosrc/shared/text/middle-ellipsis.ts, takes the locale as a parameter, and gainsemailEllipsis.MiddleEllipsisText: on the page it measures the line (canvas, against the text's laid-out width) and caches cuts; native text uses the platform's own middle ellipsis.ListRowgainstitleEllipsis: 'middle' | 'email'.Toasts are unchanged: they wrap, so "Signed in as …" already shows the whole email.
Why
The phone's page can only end-truncate text, which drops exactly the part of a long email that differs. Reusing desktop's measured middle cut keeps one implementation. An even middle cut alone wasn't enough: two logins on one domain often differ right after the start of the name (e.g. "+claude-team"), which an even cut removes, so emails keep the name and shorten the domain.
Linked Issue
No issue; follow-up to #51701 (the approved Accounts design called for middle truncation of emails).
Visual Proof
Two Claude accounts on
northwind-industries-holdings.example.com, iOS simulator, against a serve built from this branch (before = main's page):Toast after adding an account (unchanged, wraps to show the full email): (screenshot removed: contained real product data)
Testing
Added both accounts through the phone's sign-in sheet on an iOS 27 simulator (OTA page) and checked dark and light. One test pins the email rule: two long emails on one domain stay distinct at the same width (fails with an even middle cut). Desktop's run-target picker still uses the moved helper (typecheck and the render-path ratchet pass).
Performance
Only Accounts rows whose titles ask for it pay anything. On the page each such title reads its computed style and width once per mount or font change and runs a short binary search of canvas measurements only on a cache miss; cuts are cached by text/font/width (1,024 entries), so unchanged renders and remounts (e.g. a row going busy during a switch) do no canvas work.
Risk
Low. Visible only in account rows on the phone and in desktop's run-target picker (same algorithm, now shared). If measurement isn't available, the text falls back to today's end truncation. Plain revert backs it out.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Page-only on the phone (ships with the computer's page update); no store build needed.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)