fix: chat ui msg misalignment#2785
Conversation
Greptile SummaryThis PR changes pinned chat-message alignment to use measured transcript geometry. The main changes are:
Confidence Score: 4/5The changed flow looks mergeable after tightening the zero-width measurement fallback.
packages/chat-ui/src/ChatRoot.tsx
|
| Filename | Overview |
|---|---|
| packages/chat-ui/src/ChatRoot.tsx | Adds transcript-column geometry measurement and applies it to pinned user-message overlays. |
| packages/chat-ui/src/chat-root.css.ts | Moves pinned overlay alignment responsibility from fixed gutter padding to a measured inner column. |
| packages/chat-ui/src/chat-view.contract.test.tsx | Adds browser-facing coverage that compares the pinned user card against the measured transcript width probe. |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/chat-ui/src/ChatRoot.tsx:368
**Zero-Width Probe Freezes Geometry**
When a host `contentClass` temporarily makes the width probe measure `0`, this guard skips the update and leaves the pinned overlay on the previous geometry, or on the initial `0px` width. The transcript classes can later recover, but no geometry state is written for the zero-width transition, so a pinned user message can render collapsed or at the stale offset instead of matching the transcript column.
Reviews (1): Last reviewed commit: "fix: chat ui msg misalignment" | Re-trigger Greptile
| if (!widthProbeEl || !outerEl) return; | ||
| const probeRect = widthProbeEl.getBoundingClientRect(); | ||
| const outerRect = outerEl.getBoundingClientRect(); | ||
| if (probeRect.width <= 0) return; |
There was a problem hiding this comment.
Zero-Width Probe Freezes Geometry
When a host contentClass temporarily makes the width probe measure 0, this guard skips the update and leaves the pinned overlay on the previous geometry, or on the initial 0px width. The transcript classes can later recover, but no geometry state is written for the zero-width transition, so a pinned user message can render collapsed or at the stale offset instead of matching the transcript column.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/chat-ui/src/ChatRoot.tsx
Line: 368
Comment:
**Zero-Width Probe Freezes Geometry**
When a host `contentClass` temporarily makes the width probe measure `0`, this guard skips the update and leaves the pinned overlay on the previous geometry, or on the initial `0px` width. The transcript classes can later recover, but no geometry state is written for the zero-width transition, so a pinned user message can render collapsed or at the stale offset instead of matching the transcript column.
How can I resolve this? If you propose a fix, please make it concise.
the scrollbar on devices that have a mouse connected lead to a misalignment between the transcript messages and the sticky messages in the chat ui