The best way to control Claude Code, Codex and more from any computer or phone
refactor(web): composer overlay re-measures from one layout effect (#25915)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 27, 2026 at 05:17 UTC
a4fe62ecfb595d2f40134bcd804bc6660b83d0b2
1 file changed
+8
-13
apps/web/src/components/ChatView.tsx
+8
-13
@@ -708,7 +708,6 @@ export default function ChatView(props: ChatViewProps) {
708
const composerReservedHeightRef = useRef(0);
709
const composerExpandedHeightRef = useRef(0);
710
const composerRestingRef = useRef(false);
711
- const composerMountedRef = useRef(true);
711
const [scrollToEndClearance, setScrollToEndClearance] = useState(0);
712
const [timelineOverflows, setTimelineOverflows] = useState(false);
713
const fanoutSelectionsAtom = draftFanoutSelectionsAtom(routeThreadKey);
@@ -2127,7 +2126,7 @@ export default function ChatView(props: ChatViewProps) {
2126
const nextHeight = Math.ceil(height);
2127
if (nextHeight <= 0) return;
2128
const isResting = overlayComposerIsResting({
2130
- composerMounted: composerMountedRef.current,
2129
+ composerMounted,
2130
composerReportedResting: composerRestingRef.current,
2131
});
2132
const modelStrip = composerOverlayElement?.querySelector<HTMLElement>(
@@ -2200,8 +2199,13 @@ export default function ChatView(props: ChatViewProps) {
2199
composerReservedHeightRef.current = 0;
2200
composerExpandedHeightRef.current = 0;
2201
publishComposerOverlayHeightStable(composerOverlayElement.getBoundingClientRect().height);
2203
- // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A thread switch must re-measure the overlay for the new timeline.
2204
- }, [activeThreadKey, composerOverlayElement, publishComposerOverlayHeightStable]);
2202
+ }, [
2203
+ // oxlint-disable-next-line react/exhaustive-effect-dependencies -- A thread switch or a composer mount/unmount must re-measure the overlay for the new timeline.
2204
+ activeThreadKey,
2205
+ composerMounted,
2206
+ composerOverlayElement,
2207
+ publishComposerOverlayHeightStable,
2208
+ ]);
2209
2210
useLayoutEffect(() => {
2211
if (!composerOverlayElement) return;
@@ -2226,15 +2230,6 @@ export default function ChatView(props: ChatViewProps) {
2230
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- The scroll-to-bottom button changes the overlay's height without resizing the observed node first.
2231
showScrollToBottom,
2232
]);
2229
- useLayoutEffect(() => {
2230
- if (composerMountedRef.current === composerMounted) return;
2231
- composerMountedRef.current = composerMounted;
2232
- if (!composerOverlayElement) return;
2233
- composerTimelineInsetRef.current = 0;
2234
- composerReservedHeightRef.current = 0;
2235
- composerExpandedHeightRef.current = 0;
2236
- publishComposerOverlayHeightStable(composerOverlayElement.getBoundingClientRect().height);
2237
- }, [composerMounted, composerOverlayElement, publishComposerOverlayHeightStable]);
2233
const openPanelPullRequestUrl = useOpenPanelPullRequestUrl(activeThreadRef);
2234
const activeThreadReferenceCopyTarget =
2235
activeThreadId === null || !isServerThread