fix(web): keep the last message visible when the resting composer expands #9553
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 4 commits into
main fromrefs/pull/9553/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/composerFooterLayout.ts line 77Resolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -50,0 +57,21 @@57+export const COMPOSER_RESTING_EXPANSION_MIN_PX = 94;58+59+/**60+ * The space the timeline reserves at its end for the composer overlay.61+ *62+ * The overlay is measured live, but a resting composer is much shorter than63+ * an expanded one. Reserving only the resting height lets a scroll to the end64+ * land flush against the short composer, and the expansion that follows then65+ * covers the last rows because the timeline never moves for footer growth.66+ * While resting, the reservation keeps the last expanded height, or at least67+ * the resting height plus the empty expansion, so expanding again changes68+ * nothing above the composer. An expanded measurement is authoritative and69+ * may shrink it.70+ */71+export function resolveComposerTimelineInset(input: {72+ currentInset: number;73+ overlayHeight: number;74+ isResting: boolean;75+}): number {76+ return input.isResting77+ ? Math.max(input.currentInset, input.overlayHeight + COMPOSER_RESTING_EXPANSION_MIN_PX)apps/web/src/components/ChatView.tsx line 4992OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -4965,6 +4972,21 @@49654972 setComposerOverlayHeight(nextHeight);49664973 }4974+ const nextInset = resolveComposerTimelineInset({4975+ currentInset: composerTimelineInsetRef.current,4976+ overlayHeight: nextHeight,4977+ isResting: composerRestingRef.current,4978+ });4979+ if (composerTimelineInsetRef.current !== nextInset) {4980+ composerTimelineInsetRef.current = nextInset;4981+ setComposerTimelineInset(nextInset);4982+ }49674983 setScrollToEndClearance((currentClearance) =>49684984 currentClearance === nextHeight ? currentClearance : nextHeight,49694985 );49704986 }, []);4987+ // The composer reports the destination geometry of each resting transition4988+ // together with the state it belongs to, so the reservation never pairs a4989+ // resting flag with the other layout's height.4990+ const publishComposerOverlayGeometry = useCallback(4991+ (height: number, resting: boolean) => {4992+ composerRestingRef.current = resting;
- apps/web/src/components/ChatView.tsx line 5002Resolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -4967,4 +4983,21 @@49674983 setScrollToEndClearance((currentClearance) =>49684984 currentClearance === nextHeight ? currentClearance : nextHeight,49694985 );49704986 }, []);4987+ // The composer reports the destination geometry of each resting transition4988+ // together with the state it belongs to, so the reservation never pairs a4989+ // resting flag with the other layout's height.4990+ const publishComposerOverlayGeometry = useCallback(4991+ (height: number, resting: boolean) => {4992+ composerRestingRef.current = resting;4993+ publishComposerOverlayHeight(height);4994+ },4995+ [publishComposerOverlayHeight],4996+ );4997+ // A held reservation belongs to the previous thread's draft. Rebuild it from4998+ // this thread's overlay so a tall draft elsewhere does not pad this one.4999+ useLayoutEffect(() => {5000+ if (!composerOverlayElement) return;5001+ composerTimelineInsetRef.current = 0;5002+ publishComposerOverlayHeight(composerOverlayElement.getBoundingClientRect().height);5003+ }, [activeThreadKey, composerOverlayElement, publishComposerOverlayHeight]);
- apps/web/src/components/ChatView.tsx line 4997OutdatedResolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -4967,4 +4977,21 @@4977+ isResting: composerRestingRef.current,4978+ });4979+ if (composerTimelineInsetRef.current !== nextInset) {4980+ composerTimelineInsetRef.current = nextInset;4981+ setComposerTimelineInset(nextInset);4982+ }49674983 setScrollToEndClearance((currentClearance) =>49684984 currentClearance === nextHeight ? currentClearance : nextHeight,49694985 );49704986 }, []);4987+ // The composer reports its resting flag from a layout effect, which runs4988+ // before this component's own layout effects and before any resize4989+ // observation, so every measurement below sees the flag for its layout.4990+ // A flag change with no height change still recomputes the reservation.4991+ const onComposerRestingChange = useCallback(4992+ (resting: boolean) => {4993+ if (composerRestingRef.current === resting) return;4994+ composerRestingRef.current = resting;4995+ if (composerOverlayHeightRef.current > 0) {4996+ publishComposerOverlayHeight(composerOverlayHeightRef.current);4997+ }
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.



Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
617edab· PR result:166dc41· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.