From dbd6a08247324b6457f18143c9bb7eb9ba298273 Mon Sep 17 00:00:00 2001 From: Maya Kid <29959320+Maya-Kid@users.noreply.github.com> Date: Thu, 15 Oct 2026 18:45:20 +1100 Subject: [PATCH] Keep the draft visible when the composer changes width Signed-off-by: Maya Kid <29959320+Maya-Kid@users.noreply.github.com> --- src/components/ui/composer.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/ui/composer.tsx b/src/components/ui/composer.tsx index 697e3ca..b6a3152 100644 --- a/src/components/ui/composer.tsx +++ b/src/components/ui/composer.tsx @@ -73,6 +73,20 @@ function Composer({ el.style.height = `${el.scrollHeight}px` }, []) React.useLayoutEffect(resize, [value, resize]) + React.useLayoutEffect(() => { + const el = textarea.current + if (!el || typeof ResizeObserver === "undefined") return + // Side panels and attachments change wrapping without changing the text. + // Observe width alone so writing the new height cannot feed back into it. + let width = -1 + const observer = new ResizeObserver(([entry]) => { + if (entry.contentRect.width === width) return + width = entry.contentRect.width + resize() + }) + observer.observe(el) + return () => observer.disconnect() + }, [resize]) const submit = () => { if (!ready) return