Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): cap list layout passes to prevent React error 185 #23315

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/23315/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 120 additions and 11 deletions.

x
0 of 3 viewed, 3 left
46 additions and 1 deletionapps/web/src/components/chat/MessagesTimeline.browser.test.tsxModified
View file
@@ -1,6 +1,6 @@
import { EnvironmentId, MessageId, RunId, ScheduledTaskId } from "@t3tools/contracts";
import type { LegendListRef } from "@legendapp/list/react";
-import { createRef, type ComponentProps, type ReactElement } from "react";
+import { createRef, Profiler, type ComponentProps, type ReactElement } from "react";
import { describe, expect, it, vi } from "vite-plus/test";
​
import "~/index.css";
@@ -129,6 +129,51 @@
const AUTOMATION_PROMPT = "Triage the inbox\n\nLabel every new issue and close duplicates.";
​
describe("MessagesTimeline messages", () => {
+ it("settles when equally long messages have very different rendered heights", async () => {
+ const props = baseProps();
+ const tall = message("a\n\n".repeat(6000), { role: "assistant" }, "tall");
+ const earlier = Array.from({ length: 80 }, (_, index) =>
+ message(
+ `<details><summary>Reply ${index}</summary>${"compact ".repeat(2250)}</details>`,
+ { role: "assistant" },
+ `earlier-${index}`,
+ ),
+ );
+ let nestedCommits = 0;
+ let maxNestedCommits = 0;
+ const onRender = (_id: string, phase: string) => {
+ nestedCommits = phase === "nested-update" ? nestedCommits + 1 : 0;
+ maxNestedCommits = Math.max(maxNestedCommits, nestedCommits);
+ };
+ const timeline = (entries: Entry[]) => (
+ <Profiler id="timeline" onRender={onRender}>