fix(DuoChatConversation): key messages by id so state survives prepend

What does this MR do?

Keys DuoChatConversation messages and tool groups by message id instead of by position, so local state stays with its message when a host prepends older messages.

Today an expanded tool group or submitted feedback is tied to an index. When older messages are prepended, every index shifts and that state shows on a different, older message.

  • Each item is keyed by its message id. A tool approval request and its tool result share an id, so a repeat gets a suffix. An item without an id is keyed by its offset from the last item with one.
  • The key sits on a wrapper div, not on the children of a <template v-for>: Vue 3 ignores keys there and Vue 2 rejects a keyed template.

Hosts that only append messages see no change.

Why this MR shrank

This MR first added lazy loading to AgenticDuoChat (scroll trigger, scroll restore, loading icon). As Enrique pointed out, the monolith hasn't rendered AgenticDuoChat since gitlab@0f7d198e, and its scrolling lives in duo_chat_scroll_region.vue. So the scroll handling moved to gitlab!267151 (merged), and this MR keeps only the part the monolith does use: DuoChatConversation, which it renders as DuoChatContextConversation.

Related:

Screenshots or screen recordings

Not applicable: no visual change.

Integration merge requests

Does this MR meet the acceptance criteria?

This checklist encourages the authors, reviewers, and maintainers of merge requests (MRs) to confirm changes were analyzed for conformity with the project's guidelines, security and accessibility.

Toggle the acceptance checklist

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidelines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened (see integration merge requests above).
  • Added the ~"component:*" label(s) if applicable.

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/product-security/psirt-group
  • Security reports checked/validated by a reviewer from the PSIRT team

Accessibility

If this MR adds or modifies a component, take a few moments to review the following:

  • All actions and functionality can be done with a keyboard.
  • Links, buttons, and controls have a visible focus state.
  • All content is presented in text or with a text equivalent. For example, alt text for SVG, or aria-label for icons that have meaning or perform actions.
  • Changes in a component’s state are announced by a screen reader. For example, changing aria-expanded="false" to aria-expanded="true" when an accordion is expanded.
  • Color combinations have sufficient contrast.
Edited by Tomas Bulva

Merge request reports

Loading
Loading