Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): reliably follow latest thread content #5905

ClosedLordMerc(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/5905/headopened View on GitHub

Showing 5 changed files with 99 additions and 0 deletions (loading 3).

x
0 of 5 viewed, 5 left
95 additions and 0 deletionsapps/web/src/components/chat/MessagesTimeline.test.tsxModified
View file
@@ -3,6 +3,7 @@
import { renderToStaticMarkup } from "react-dom/server";
import { beforeAll, describe, expect, it, vi } from "vite-plus/test";
import type { LegendListRef } from "@legendapp/list/react";
+import { resolveTimelineLiveFollowEnabled } from "./timelineScrollAnchoring";
​
vi.mock("@legendapp/list/react", async () => {
const legendListTestId = "legend-list";
@@ -38,11 +39,28 @@
size?: boolean;
shouldRestorePosition?: (item: { id: string }) => boolean;
};
+ onItemSizeChanged?: (info: {
+ index: number;
+ itemData: { id: string };
+ itemKey: string;
+ previous: number;
+ size: number;
+ }) => void;
ref?: Ref<LegendListRef>;
}) => {
if (props.anchoredEndSpace) {
props.anchoredEndSpace.onReady?.({ anchorIndex: props.anchoredEndSpace.anchorIndex });
+ const lastItem = props.data.at(-1);
+ if (lastItem) {
+ props.onItemSizeChanged?.({
+ index: props.data.length - 1,
+ itemData: lastItem,