fix(chat): stop the streaming transcript floor inventing scroll space - #6527
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 0369620. Configure here. |
Greptile SummaryThe PR prevents short streaming transcripts from creating phantom scroll space and adds explicit floor-state cleanup when switching chats.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx | Integrates bounded floor computation, resets transcript-specific floor state on chat changes, and uses the required absolute import. |
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/sizer-floor.ts | Encapsulates the floor and high-water calculation that prevents viewport extent from inventing content space. |
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/sizer-floor.test.ts | Covers short transcripts, fractional and negative extents, content shrinkage, growth, and interrupted floor drains. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Transcript layout commit] --> B{Chat changed?}
B -->|Yes, distinct chat| C[Cancel drain and clear floor state]
B -->|No or pending chat persisted| D{Floor active?}
C --> D
D -->|Yes| E[Compute content high-water mark]
E --> F[Clamp viewport extent to high-water mark]
F --> G[Apply bounded min-height]
D -->|No| H[Drain or clear applied floor]
Reviews (3): Last reviewed commit: "fix(chat): release the transcript floor ..." | Re-trigger Greptile
Greptile SummaryThe PR extracts the transcript floor calculation and clamps it to content held during the active turn, with focused unit coverage.
Confidence Score: 4/5The PR should not merge until the floor’s high-water state is reset when the active chat changes; the import-convention issue is non-blocking. A retained component can apply the previous tall chat’s high-water mark to a newly selected short chat for at least one layout pass, recreating artificial scroll space that then drains visibly. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx; apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/sizer-floor.test.ts
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx | Integrates content-clamped floor tracking, but the new high-water ref can cross chat boundaries and recreate phantom space. |
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/sizer-floor.ts | Provides a clear pure calculation that clamps viewport extent to content and applied-floor high-water state. |
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/sizer-floor.test.ts | Covers the pure floor arithmetic well, but does not exercise the component-level transcript reset boundary. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Tall chat is streaming] --> B[heldHighWater records tall content]
B --> C[User switches to cached short chat]
C --> D[MothershipChat instance and refs persist]
D --> E[Layout effect runs while lastRowAnimating is still true]
E --> F[nextSizerFloor retains old high-water]
F --> G[Short chat receives artificial min-height]
G --> H[Floor drains over subsequent frames]
Reviews (1): Last reviewed commit: "fix(chat): stop the streaming transcript..." | Re-trigger Greptile
The sizer floor was the viewport's bottom edge (scrollTop + clientHeight), which exceeds the content height whenever the transcript is shorter than the viewport. That invents scrollable space no content occupies, and a mid-turn container shrink turns it into real scroll room the bottom-pin scrolls into. Clamp the floor to the space content has actually held this turn: the max of the virtualizer's total size and the still-applied floor. The applied-floor term keeps undrained debt across a turn boundary that interrupts the drain.
The high-water mark and applied floor are per-turn refs on a component that survives a chat switch, so a tall chat's mark could size a newly opened short one for as long as the outgoing turn kept the floor engaged. Release both outright on a chat change — the switch re-lands the viewport, so there is no eased settle to preserve — while treating a pending chat adopting its id as the same conversation. Also switch the sizer-floor import to the absolute path convention.
3c8ad63 to
0369620
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0369620. Configure here.
Summary
scrollTop + clientHeight), which exceeds the content height whenever the transcript is shorter than the viewport — early in a turn, or in any short chat. That invents scrollable space no content occupies.nextSizerFloorwith unit tests.Type of Change
Testing
Measured in Chromium against a harness rendering the real virtualizer,
useAutoScroll, and the floor effect:509 home tests pass; typecheck and lint clean.
Note: verified in a harness that reconstructs the transcript with the real modules, not in the running app — worth a live spot-check on a short first reply.
Checklist