Repository navigation
fix(web): clip matching restore names only while they overflow - #5042
Conversation
The "match this server" list clipped every name sideways, so in Firefox a name that fits lost the parts of its marks above the line, such as Vietnamese stacked diacritics. SameRow now measures its name with useOverflowsInline and clips only a name still wider than the row after wrapping. Clipped item and account names and the "Merge into" line take the same start room as a clipped profile name: 0.25em of start padding offset by a negative margin, so a first letter whose ink reaches before its box stays whole, with the end cut still on the container's edge. Rows with a detail use NARROW_OVERFLOW_CLIP, the same classes below the 42rem container breakpoint. ProfileRow uses the shared hook instead of its own copy of the measurement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 11 minutes. View limit details
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| }) { | ||
| useT(); | ||
| const label = displayLabel(item); | ||
| const [nameRef, nameOverflows] = useOverflowsInline<HTMLSpanElement>(label); |
There was a problem hiding this comment.
S1 [P2] Opening a large matching-items list blocks on every label. SameRows mounts the full result inside a max-h-80 scrollbox. When a same-server backup has thousands of matching artwork entries, this hook measures every row before paint and registers a resize observer and font listener for each, including offscreen rows. In a production React fixture with the old and new SameRow and 5,000 artwork labels, the synchronous mount went from 7–9 ms to 72–74 ms in Chromium and from 25–42 ms to 125–230 ms in Firefox. The new rows made 15,000 text measurements across mount and the first resize and font callbacks. Window or paginate the list so mounting and measuring rows stays bounded as the backup grows.
# Conflicts: # web/src/pages/admin-backups/RestoreRows.tsx
Problem
Closes #4946
Related issue: N/A
Validation tasks: none
Other clients: N/A (backup restore is only in the web admin)
On the backup restore Choose step, the "match this server" list always clipped its names sideways. In Firefox that clip also cuts vertically, so names that fit lost the tops of marks above the line. Vietnamese stacked diacritics and combining marks lost their top pixel row.
Names that do overflow, and so need the clip, had a smaller problem. Item names, account names and the "Merge into" line were clipped with no room at the start edge, so a first letter whose ink reaches before its box lost a sliver. A leading "j" and the first letter of an Arabic name both lost one.
With this change, a "match this server" name is clipped only while it is still wider than its row after wrapping. Every clipped restore name keeps its first letter whole, and its end is cut at the edge of its label or row.
#4987 fixed the other places #4946 lists: the library heading, the Review lists and the Run report rows. This pull request does the "match this server" rows, which finishes the issue. It uses #4987's measurement and its
OVERFLOW_CLIPclasses.Approach
useOverflowsInline.tsgainsNARROW_OVERFLOW_CLIP, the same classes asOVERFLOW_CLIP, applied only below the 42rem container breakpoint. Above that width, a row with a detail beside the name truncates instead.OVERFLOW_CLIPadds 0.25em of start padding, offset by a negative margin.max-w-[calc(100%+0.25em)], so a name capped atmax-w-fullstill ends on its container's edge.SameRowmeasures its name with the hook and clips only while it overflows. Its name keeps the direction and alignment from fix(web): keep restore row names in their own direction in right-to-left languages #5007.ProfileRowuse the shared classes.ProfileRowdrops its inline copy of the oldscrollWidthmeasurement and uses the hook.Validation
main, then rebuilt it from this branch, with the same data both times.main, an overflowing "match this server" name ended 0.25em past its row.cn, and overflow was measured as each side's code measures it. It covered Chromium, Firefox, Firefox with a 24 px minimum font size, and WebKit; rows of 300, 360 and 900 px; default and Extra large text; 1× and 2×; both directions.main, Firefox changed Vietnamese, Thai and combining-mark "match this server" names, in up to 18 of 24 configurations.maincut a leading "j" by up to 214/255 and a leading Arabic letter by up to 106/255. Both are now 0/255.tsc -b, format check, build and bundle budget pass, and so doverify-local-paths,verify-bidi,verify-case-collisionsandverify-size-ratchet.make test-webfailed 5 files, none in admin backups.mainon this machine, fromlocalStorageunder Node 26.main.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/issue-4946/
Risks
While the "match this server" fold is open, each row keeps its own ResizeObserver, as ItemRow rows already do. With 3,000 rows, opening the list took no extra time in Chromium and about 0.1 s longer in Firefox.
Checklist
Council review
Rounds: 1, last reviewed 3c7b63f
Visual review: 2 rounds, on captures from an earlier build of this change, before it was rebased onto #4987 and #5007. I checked the current head's captures against them myself.
Fixed: nothing needed fixing.
Answered:
AI Disclosure
🤖 Generated with Claude Code
Note
Clip overflowing restore names conditionally in admin-backups UI
useOverflowsInlinehookNARROW_OVERFLOW_CLIPclass constant in useOverflowsInline.ts as the narrow-row variant used under the@max-2xlcontainer queryOVERFLOW_CLIPorNARROW_OVERFLOW_CLIPto overflowing names and merge-status textSameRowMacroscope summarized ad39de7.