From 068acd735531aca6fe012bffe35853812695fe3f Mon Sep 17 00:00:00 2001 From: morgmart <98432065+morgmart@users.noreply.github.com> Date: Mon, 17 Aug 2026 14:43:19 -0700 Subject: [PATCH 1/2] fix(chat): keep agent work expansions anchored --- src/features/chat/ui/AgentWorkPanel.tsx | 15 +++++- src/features/chat/ui/ToolCallAdapter.tsx | 5 +- .../chat/ui/VirtualMessageTimeline.tsx | 7 ++- .../ui/__tests__/ToolCallAdapter.test.tsx | 19 ++++++++ .../__tests__/VirtualMessageTimeline.test.tsx | 48 +++++++++++++++++++ 5 files changed, 90 insertions(+), 4 deletions(-) diff --git a/src/features/chat/ui/AgentWorkPanel.tsx b/src/features/chat/ui/AgentWorkPanel.tsx index 50feea638..02753e708 100644 --- a/src/features/chat/ui/AgentWorkPanel.tsx +++ b/src/features/chat/ui/AgentWorkPanel.tsx @@ -27,6 +27,7 @@ import type { ToolCallStatus, } from "@/shared/types/messages"; import type { TranscriptAgentWorkPayload } from "@/features/chat/transcript/projection/transcriptItemTypes"; +import { useTranscriptRowStateAdapter } from "@/features/chat/transcript/row-state"; import { ToolCallAdapter } from "./ToolCallAdapter"; interface ToolTimelineItem { @@ -351,6 +352,7 @@ export function AgentWorkPanel({ }) { const { t } = useTranslation("chat"); const prefersReducedMotion = useReducedMotion(); + const { markRowInteracted, pinScrollAnchor } = useTranscriptRowStateAdapter(); const items = useMemo( () => buildAgentWorkTimeline(payload.content), [payload.content], @@ -423,7 +425,12 @@ export function AgentWorkPanel({ return ( { + markRowInteracted("agent-work-disclosure"); + pinScrollAnchor(); + setOpen(nextOpen); + }} + data-role="agent-work-panel" className="mt-3 w-full min-w-0 max-w-full" >
@@ -484,7 +491,11 @@ export function AgentWorkPanel({ > { + markRowInteracted("agent-work-previous-steps"); + pinScrollAnchor(); + setPreviousStepsOpen(nextOpen); + }} >