From 569c9784a61d49c973c074cf29ca97096fbc5b0d Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 4 Aug 2026 21:43:35 -0700 Subject: [PATCH] [eric] chat: the mini self-heals its slot fit every 500ms, a remounted slot can no longer leave it scaled against a stale rect --- frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx b/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx index c6bf6d3c..267dec57 100644 --- a/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx +++ b/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx @@ -305,6 +305,8 @@ const BrowserCard: React.FC = ({ window.addEventListener('openswarm:canvas-pan-changed', measure); document.addEventListener('visibilitychange', measure); const timers = [60, 250, 700].map((ms) => window.setTimeout(measure, ms)); + // Self-heal: the slot lives in the WINDOWED transcript and remounts without firing any of the events above, which left the mini scaled against a stale rect (visibly overflowing its frame) until the next pan. 500ms bounds how long any staleness can survive. + const heal = window.setInterval(measure, 500); return () => { ro.disconnect(); window.removeEventListener('resize', measure); @@ -313,6 +315,7 @@ const BrowserCard: React.FC = ({ scrollHost?.removeEventListener('scroll', onScroll); if (scrollRaf) cancelAnimationFrame(scrollRaf); timers.forEach((tm) => window.clearTimeout(tm)); + window.clearInterval(heal); }; // dockParentCard x/y/w/h are re-measure triggers: the slot's client rect moves with the chat card. }, [dockedTo, dockParentExpanded, dockParentTiled, dockParentCard?.x, dockParentCard?.y, dockParentCard?.width, dockParentCard?.height, getCanvasState, dockParentCard]);