Skip to content

Commit 96c8a4d

Browse files
committed
fix(web): preserve overflow toggle spacing
1 parent 4dcdd96 commit 96c8a4d

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

apps/web/src/components/chat/MessagesTimeline.logic.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ describe("deriveMessagesTimelineRows", () => {
16831683
});
16841684

16851685
it("labels mixed-group overflow from the entries actually hidden", () => {
1686-
const rows = deriveMessagesTimelineRows({
1686+
const input = {
16871687
timelineEntries: [
16881688
{
16891689
id: "tool-entry-1",
@@ -1724,12 +1724,23 @@ describe("deriveMessagesTimelineRows", () => {
17241724
activeTurnStartedAt: null,
17251725
turnDiffSummaryByAssistantMessageId: new Map(),
17261726
revertTurnCountByUserMessageId: new Map(),
1727+
} satisfies Parameters<typeof deriveMessagesTimelineRows>[0];
1728+
const rows = deriveMessagesTimelineRows(input);
1729+
const expandedRows = deriveMessagesTimelineRows({
1730+
...input,
1731+
expandedWorkGroupIds: new Set(["work-group:tool-entry-1"]),
17271732
});
17281733

17291734
expect(rows.find((row) => row.kind === "work-toggle")).toMatchObject({
17301735
hiddenCount: 1,
17311736
onlyToolEntries: true,
17321737
});
1738+
expect(expandedRows.at(-1)).toMatchObject({
1739+
kind: "work-toggle",
1740+
expanded: true,
1741+
onlyToolEntries: true,
1742+
summary: null,
1743+
});
17331744
});
17341745

17351746
it("keeps error entries visible instead of summarizing them as tools", () => {

apps/web/src/components/chat/MessagesTimeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ const TimelineRowContent = memo(function TimelineRowContent({ row }: { row: Time
915915
const isExpandedToolGroupEntry = row.kind === "work" && row.isExpandedToolGroupEntry;
916916
const isLastExpandedToolGroupEntry = row.kind === "work" && row.isLastExpandedToolGroupEntry;
917917
const isExpandedToolGroupHeader =
918-
(row.kind === "work-toggle" && row.onlyToolEntries && row.expanded) ||
918+
(row.kind === "work-toggle" && row.summary !== null && row.onlyToolEntries && row.expanded) ||
919919
(row.kind === "work-live" && row.expanded);
920920

921921
return (

0 commit comments

Comments
 (0)