Ask for older Duo Chat messages from the scroll region

What does this MR do and why?

Teaches DuoChatScrollRegion to ask for older messages when the user scrolls near the top, and to keep the reader's place when they are prepended. It stays off until a parent passes has-older-messages, which nothing does yet.

This is the second of three MRs split out of !266759 (merged), which lazy loads Duo Chat history behind duo_chat_lazy_load_messages.

  • DuoChatScrollRegion emits load-older-messages from its existing throttled scroll handler when the user is within 200px of the top, once per load. It shows a loading icon at the top while the parent loads a page.
  • When the first message id changes after a request, a page was prepended. The region keeps the reader's distance from the bottom, so the history doesn't jump.
  • DuoAgenticChatView passes has-older-messages, is-loading-older-messages and the first message id through, and re-emits load-older-messages.
  • DuoAgenticChatView keys each conversation by the /reset that starts it, not by position. A prepended page with a /reset in it would otherwise shift every later conversation and remount it.
Why it restores the distance from the bottom
  • The monolith hasn't rendered duo-ui's AgenticDuoChat since 0f7d198e, so the scroll trigger and restore from duo-ui!810 (merged) live here.
  • The turn-based layout (duo_chat_redesign) turns off native scroll anchoring and pins each request near the top, with blank room below it. So a prepend restores the distance from the bottom, not the top, and moves the pin's boundary index past the nodes the page adds before re-measuring.
  • The loading icon sits outside the transition-group, whose leave transition would keep it rendered after the prepend and offset the restored position.

References

Screenshots or screen recordings

Not applicable yet: nothing turns the behavior on until !266759 (merged). Screenshots will go there.

How to set up and validate locally

No visible change on its own. To try it end to end, check out !266759 (merged) together with this MR and !267150 (merged), then follow the steps there.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tomas Bulva

Merge request reports

Loading
Loading