Stabilize web timeline height estimates

This commit is contained in:
Mohamed Boudra
2026-04-24 11:55:43 +07:00
parent 480b18c500
commit 0c3d15ffb9
5 changed files with 201 additions and 7 deletions
@@ -54,6 +54,16 @@ function toolCall(id: string, seed: number): StreamItem {
};
}
function thought(id: string, seed: number): StreamItem {
return {
kind: "thought",
id,
text: id,
status: "ready",
timestamp: createTimestamp(seed),
};
}
function indexEntries(items: StreamItem[]): IndexedStreamItem[] {
return items.map((item, index) => ({ item, index }));
}
@@ -111,6 +121,11 @@ describe("splitWebVirtualizedHistory", () => {
});
describe("estimateStreamItemHeight", () => {
it("uses compact estimates for collapsed tool sequence rows", () => {
expect(estimateStreamItemHeight(toolCall("tool", 1))).toBe(40);
expect(estimateStreamItemHeight(thought("thought", 2))).toBe(40);
});
it("uses a larger estimate for user messages with image attachments", () => {
const item: StreamItem = {
kind: "user_message",