From 36cf7debce1cb29ad9ec5e46dbe5272221e0e655 Mon Sep 17 00:00:00 2001 From: Jeremy Ruppel Date: Tue, 7 Apr 2026 19:04:05 -0400 Subject: [PATCH] fix(site): add resize observer to session timeline expandable text (#24119) I said I wouldn't but the illustrious @jakehwll added a ResizeObserver recently so imma do that too. This makes `` determine if it should be expandable or not on resize --- .../SessionTimeline/SessionTimeline.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/site/src/pages/AIBridgePage/SessionThreadsPage/SessionTimeline/SessionTimeline.tsx b/site/src/pages/AIBridgePage/SessionThreadsPage/SessionTimeline/SessionTimeline.tsx index 2cbb9747d6..8cb91b1a15 100644 --- a/site/src/pages/AIBridgePage/SessionThreadsPage/SessionTimeline/SessionTimeline.tsx +++ b/site/src/pages/AIBridgePage/SessionThreadsPage/SessionTimeline/SessionTimeline.tsx @@ -48,7 +48,18 @@ const ExpandableText: FC = ({ useEffect(() => { const el = contentRef.current; if (!el) return; - setIsExpandable(el.scrollHeight > maxHeight); + + const checkIsExpandable = () => { + setIsExpandable(el.scrollHeight > maxHeight); + }; + + checkIsExpandable(); + + const observer = new ResizeObserver(checkIsExpandable); + + observer.observe(el); + + return () => observer.disconnect(); }, [maxHeight]); return (