@devries-cameron20 / t3code-1 / commits / c13d058b91
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): the composer rests on scroll when a thread opens above its end (#15025)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

tiliakoos committed Oct 19, 2026 at 21:58 UTC c13d058b91ffc7c1198f5895aef4dbce3951f054
2 files changed +33 -2
apps/web/src/components/chat/timelineScrollAnchoring.test.tsx
+26
@@ -57,7 +57,33 @@ describe("timelineContentOverflowsViewport", () => {
57 inset,
58 ),
59 ).toBe(false);
60 + expect(
61 + timelineContentOverflowsViewport(
62 + buildState({ positions: [0, Number.NaN], sizes: [200] }),
63 + inset,
64 + ),
65 + ).toBe(false);
66 });
67 +
68 + it.each([
69 + { measurement: "missing", sizes: [200] },
70 + { measurement: "NaN", sizes: [200, Number.NaN] },
71 + ])(
72 + "reports overflow with a $measurement tail size without inventing anchor metrics",
73 + ({ sizes }) => {
74 + const state = buildState({ positions: [0, 900], sizes });
75 + expect(timelineContentOverflowsViewport(state, inset)).toBe(true);
76 + expect(getRowBottom(state, 1)).toBeNull();
77 + expect(
78 + getAnchoredTurnMetrics({
79 + state,
80 + anchorIndex: 0,
81 + composerOverlayHeight: 100,
82 + anchorOffset: 24,
83 + }),
84 + ).toBeNull();
85 + },
86 + );
87 });
88
89 describe("timeline scroll anchoring", () => {
apps/web/src/components/chat/timelineScrollAnchoring.ts
+7 -2
@@ -75,7 +75,7 @@ export function getRowBottom(state: TimelineListMeasurementState, index: number)
75
76 /**
77 * The list's own content length includes the composer inset spacer, so this
78 - * measures from the last row instead. Unknown row geometry or an unmeasured
78 + * measures from the last row instead. Unknown row positions or an unmeasured
79 * viewport counts as fitting.
80 */
81 export function timelineContentOverflowsViewport(
@@ -89,7 +89,12 @@ export function timelineContentOverflowsViewport(
89 if (typeof scrollLength !== "number" || !Number.isFinite(scrollLength) || scrollLength <= 0) {
90 return false;
91 }
92 - const lastBottom = getRowBottom(state, state.data.length - 1);
92 + const lastIndex = state.data.length - 1;
93 + // Overflow can use an unmeasured tail's lower bound; anchored-turn metrics need its height.
94 + const lastTop = state.positionAtIndex(lastIndex);
95 + const lastBottom =
96 + getRowBottom(state, lastIndex) ??
97 + (typeof lastTop === "number" && Number.isFinite(lastTop) ? lastTop + 1 : null);
98 if (lastBottom === null) {
99 return false;
100 }