Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep chat from jumping when the scroll-to-end pill mounts #12317

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 1 commit intomain fromt3code/a064dd0dmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 1 changed file with 35 additions and 16 deletions.

x
0 of 1 viewed, 1 left
35 additions and 16 deletionsapps/web/src/components/ChatView.tsxModified
View file
@@ -1779,6 +1779,8 @@
const [composerTimelineInset, setComposerTimelineInset] = useState(0);
const composerTimelineInsetRef = useRef(0);
const composerRestingRef = useRef(false);
+ // The last overlay height the composer published for its settled layout.
+ const composerOverlayHeightRef = useRef(0);
const [scrollToEndClearance, setScrollToEndClearance] = useState(0);
const isAtEndRef = useRef(true);
const isTimelineAtLogicalEnd = useCallback(
@@ -5868,19 +5870,8 @@
? activePlan.steps
: null;
- const publishComposerOverlayHeight = useCallback(
- (height: number) => {
- const nextHeight = Math.ceil(height);
- if (nextHeight <= 0) return;
- const nextInset = resolveComposerTimelineInset({
- currentInset: composerTimelineInsetRef.current,
- overlayHeight: nextHeight,
- isResting: composerRestingRef.current,
- });
- if (composerTimelineInsetRef.current !== nextInset) {
- composerTimelineInsetRef.current = nextInset;
- setComposerTimelineInset(nextInset);
- }
+ const publishScrollToEndClearance = useCallback(
+ (overlayHeight: number) => {
const mainSurface = composerOverlayElement?.querySelector<HTMLElement>(