Skip to content

Conversation

@35C4n0r
Copy link
Collaborator

@35C4n0r 35C4n0r commented Oct 19, 2025

Description

Autoscroll/follow only kicks in if:

  • User is already at the bottom of the screen, we follow the new content
  • User sends a new message, we start following the new content.

In case when user manually scrolls up, follow is disabled.

@35C4n0r 35C4n0r self-assigned this Oct 19, 2025
@github-actions
Copy link

✅ Preview binaries are ready!

To test with modules: agentapi_version = "agentapi_128" or download from: https://github.com/coder/agentapi/releases/tag/agentapi_128

scrollAreaRef.removeEventListener("scrollend", () => isProgrammaticScrollRef.current = false);

};
}, [checkIfAtBottom, scrollAreaRef]);
Copy link
Collaborator Author

@35C4n0r 35C4n0r Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for @BrunoQuaresma
The original code also intended the same scroll UX as we do now, unfortunately the scrollAreaRef.addEventListener("scroll", handleScroll); event listener never gets attached since on the initial(and only) run of this useEffect scrollAreaRef.current; turns out out to be null and we return early. Now I have changed the scrollAreaRef to a useState instead of a useRef, which causes this useEffect to run again when the ref is set.

Copy link
Contributor

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@35C4n0r 35C4n0r merged commit db7b133 into coder:main Oct 21, 2025
3 checks passed
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.

3 participants