Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): scrolling a huge thread's history no longer loops the message list #21269

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/21269/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 53 additions and 2 deletions.

x
0 of 2 viewed, 2 left
43 additions and 1 deletionapps/web/src/components/chat/MessagesTimeline.browser.test.tsxModified
View file
@@ -8,7 +8,7 @@
ThreadId,
} from "@t3tools/contracts";
import type { LegendListRef } from "@legendapp/list/react";
-import { act, createRef, useState, type ComponentProps, type ReactElement } from "react";
+import { act, createRef, Profiler, useState, type ComponentProps, type ReactElement } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
import { userEvent } from "vite-plus/test/browser";
@@ -1165,6 +1165,48 @@
return props.listRef.current!.getScrollableNode()!;
+ it("settles when earlier short replies load above long ones", async () => {
+ const props = baseProps();
+ const short = Array.from({ length: 80 }, (_, index) =>
+ message(`Short reply ${index}`, { role: "assistant" }, `short-${index}`),
+ );
+ const long = Array.from({ length: 4 }, (_, index) =>
+ message(
+ `${"Long handbook paragraph. ".repeat(40)}\n\n`.repeat(60),
+ { role: "assistant" },
+ `long-${index}`,
+ ),
+ );
+ let nestedCommits = 0;
+ let maxNestedCommits = 0;
+ const onRender = (_id: string, phase: string) => {
+ nestedCommits = phase === "nested-update" ? nestedCommits + 1 : 0;