Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix useScrollToBottom hook for rapid content changes #7715

Merged
merged 1 commit into from
Apr 6, 2025

Conversation

tofarr
Copy link
Collaborator

@tofarr tofarr commented Apr 5, 2025

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality that this introduces.
This PR fixes an issue with the useScrollToBottom hook when content changes rapidly. The current implementation sometimes fails to maintain the scroll position at the bottom when new content is added quickly.


Give a summary of what the PR does, explaining any non-trivial design decisions.

Changes

  • Improved scroll behavior logic to better track when the user is at the bottom of the scroll area
  • Added smooth scrolling with fast animation for better user experience
  • Created a CSS class for consistent scroll behavior across components
  • Applied optimizations to all components using the scroll hook (chat interface, jupyter, invariant)

Testing

  • All existing tests pass
  • Manually verified that the scroll position stays at the bottom when content changes rapidly
  • Verified that the user can still scroll up to view previous content and the auto-scroll will only resume when they scroll back to the bottom

Link of any specific issues this addresses.


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:d6da053-nikolaik   --name openhands-app-d6da053   docker.all-hands.dev/all-hands-ai/openhands:d6da053

Sorry, something went wrong.

- Improved scroll behavior logic to better handle rapidly changing content
- Added smooth scrolling with fast animation for better user experience
- Added CSS class for consistent scroll behavior across components
- Applied optimizations to all components using the scroll hook
@tofarr tofarr marked this pull request as ready for review April 5, 2025 00:31
@tofarr tofarr merged commit c71ef11 into main Apr 6, 2025
16 checks passed
@tofarr tofarr deleted the fix-scroll-to-bottom-for-rapid-content-changes branch April 6, 2025 00:05
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.

None yet

3 participants