From f47e74004af232f0e3df8dc10093601d1c2c3ea3 Mon Sep 17 00:00:00 2001 From: Matthew Feroz <136640686+MatthewFeroz@users.noreply.github.com> Date: Mon, 31 Aug 2026 18:59:31 -0400 Subject: [PATCH] fix(web): prevent chat metadata overlap (#8851) --- apps/web/src/components/BranchToolbar.tsx | 12 ++++++---- .../BranchToolbarEnvModeSelector.tsx | 23 +++++++++++-------- apps/web/src/components/chat/ChatHeader.tsx | 11 +++++---- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx index 8a4dc581992325a5f17c86468d567a88bcb51cf5..b0b1440587ea40379402116c08009b814b7e4e89 100644 --- a/apps/web/src/components/BranchToolbar.tsx +++ b/apps/web/src/components/BranchToolbar.tsx @@ -265,8 +265,10 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean { let needed = 0; let groups = 0; for (const child of current.children) { - if (!(child instanceof HTMLElement) || child.offsetWidth <= 1) continue; - needed += contentWidth(child); + if (!(child instanceof HTMLElement)) continue; + const width = contentWidth(child); + if (width <= 1) continue; + needed += width; groups += 1; } needed += stripGap * Math.max(0, groups - 1); @@ -356,7 +358,7 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean { // Label widths can change without the strip box moving (font family or // size preferences), so re-measure on every render as well as on resize // and font loads. - useEffect(() => { + useLayoutEffect(() => { measure(); }); @@ -487,7 +489,7 @@ export const BranchToolbar = memo(function BranchToolbar({ onUsePreviousWorktree={onUsePreviousWorktree} /> ) : ( -