From 0a47534ddbbdd0bb1a4d47592fd38ce937187153 Mon Sep 17 00:00:00 2001 From: Huarch Date: Thu, 6 Aug 2026 19:07:40 +0800 Subject: [PATCH] fix(chat): restore windowed turn alignment Keep the virtual-window measurement wrapper as a flex column so AgentTurn alignSelf rules remain active. Add regression coverage for the alignment context. --- src/components/chat/AgentWorkspace.test.tsx | 21 +++++++++++++++++++++ src/components/chat/AgentWorkspace.tsx | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/components/chat/AgentWorkspace.test.tsx b/src/components/chat/AgentWorkspace.test.tsx index bf27416..9d6c019 100644 --- a/src/components/chat/AgentWorkspace.test.tsx +++ b/src/components/chat/AgentWorkspace.test.tsx @@ -216,6 +216,27 @@ describe("AgentWorkspace", () => { expect(renderCounts.size).toBeLessThan(40); }); + it("preserves the flex alignment context around windowed turns", () => { + const messages = Array.from({ length: 41 }, (_, index): Message => ({ + id: `message-${index}`, + role: index % 2 === 0 ? "user" : "assistant", + content: `message ${index}`, + })); + + render( + , + ); + + expect(screen.getByTestId("turn-message-0").parentElement).toHaveStyle({ + display: "flex", + flexDirection: "column", + }); + }); + it("keeps visible turns mounted when crossing the windowing threshold", () => { const messages = Array.from({ length: 41 }, (_, index): Message => ({ id: `message-${index}`, diff --git a/src/components/chat/AgentWorkspace.tsx b/src/components/chat/AgentWorkspace.tsx index 95f2da1..5922da4 100644 --- a/src/components/chat/AgentWorkspace.tsx +++ b/src/components/chat/AgentWorkspace.tsx @@ -254,7 +254,12 @@ const MeasuredTurn = ({ return ( {children}