Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep the last message visible when the resting composer expands #9553

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/9553/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 5 changed files with 100 additions and 22 deletions (loading 2).

x
0 of 5 viewed, 5 left
40 additions and 17 deletionsapps/web/src/components/chat/ChatComposer.tsxModified
View file
@@ -251,12 +251,14 @@
​
function useComposerRestingTransition(
isCollapsed: boolean,
+ isResting: boolean,
restingControlsRef: React.RefObject<HTMLDivElement | null>,
onOverlayHeightChange: (height: number) => void,
) {
const elementRef = useRef<HTMLDivElement>(null);
const isCollapsedRef = useRef(isCollapsed);
const previousCollapsedRef = useRef(isCollapsed);
+ const previousRestingRef = useRef(isResting);
const previousHeightRef = useRef<number | null>(null);
const previousContentOffsetsRef = useRef<{
promptFromTop: number | null;
@@ -355,6 +357,15 @@
​
const nextRect = element.getBoundingClientRect();
const nextHeight = nextRect.height;
+ // The chat view resize-observes the overlay to place the timeline
+ // inset, the scroll-to-end pill, and the mini player. Publishing the
+ // destination height here turns that feedback into one update instead
+ // of a ChatView re-render on every animation frame.
+ const overlay = element.closest<HTMLElement>('[data-chat-composer-overlay="true"]');
+ const overlayHeight = overlay?.getBoundingClientRect().height ?? null;
+ if (overlayHeight !== null) {
+ onOverlayHeightChange(overlayHeight);
+ }
const nextPromptRect = prompt?.getBoundingClientRect() ?? null;