Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Fixes workspace switch not scrolling to bottom reliably.

Problem

Clicking a workspace didn't always scroll to the bottom because async content (Shiki highlighting, Mermaid diagrams, images) rendered after the double requestAnimationFrame scroll completed.

Solution

Replace double RAF with a ResizeObserver on the inner message container. When the container grows during the auto-scroll window, we re-scroll to bottom. The observer is managed via a callback ref that properly cleans up on unmount/re-attach.

Generated with mux

@ammar-agent ammar-agent force-pushed the workspace-scroll-bug-fix branch from 88250c5 to 297bab9 Compare December 4, 2025 19:57
The previous double requestAnimationFrame approach failed when async
content (Shiki highlighting, Mermaid diagrams, images) rendered after
the scroll completed. Now we observe the inner message container for
size changes during the auto-scroll window and re-scroll as needed.

Changes:
- Add ResizeObserver in useAutoScroll that triggers scroll on growth
- Return innerRef callback ref from hook for attaching to content div
- Wire up innerRef in AIView's message container

_Generated with `mux`_
@ammar-agent ammar-agent force-pushed the workspace-scroll-bug-fix branch from 297bab9 to 6c25b1b Compare December 4, 2025 19:59
@ammario ammario merged commit 367fa4a into main Dec 4, 2025
17 checks passed
@ammario ammario deleted the workspace-scroll-bug-fix branch December 4, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants