From aae24b35a40fd76abbc8049806c70ae0eca577b0 Mon Sep 17 00:00:00 2001 From: Abhijay Jain Date: Wed, 28 Jan 2026 23:13:32 +0530 Subject: [PATCH] fix(ui): respect width parameter in MCP app size-changed notifications (#6376) Signed-off-by: Abhijay007 --- ui/desktop/src/components/McpApps/McpAppRenderer.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/desktop/src/components/McpApps/McpAppRenderer.tsx b/ui/desktop/src/components/McpApps/McpAppRenderer.tsx index a69af118..379ac592 100644 --- a/ui/desktop/src/components/McpApps/McpAppRenderer.tsx +++ b/ui/desktop/src/components/McpApps/McpAppRenderer.tsx @@ -61,6 +61,7 @@ export default function McpAppRenderer({ }); const [error, setError] = useState(null); const [iframeHeight, setIframeHeight] = useState(DEFAULT_IFRAME_HEIGHT); + const [iframeWidth, setIframeWidth] = useState(null); useEffect(() => { if (!sessionId) { @@ -200,9 +201,10 @@ export default function McpAppRenderer({ [append, sessionId, extensionName] ); - const handleSizeChanged = useCallback((height: number, _width?: number) => { + const handleSizeChanged = useCallback((height: number, width?: number) => { const newHeight = Math.max(DEFAULT_IFRAME_HEIGHT, height); setIframeHeight(newHeight); + setIframeWidth(width ?? null); }, []); const { iframeRef, proxyUrl } = useSandboxBridge({ @@ -264,7 +266,8 @@ export default function McpAppRenderer({ ref={iframeRef} src={proxyUrl} style={{ - width: '100%', + width: iframeWidth ? `${iframeWidth}px` : '100%', + maxWidth: '100%', height: `${iframeHeight}px`, border: 'none', overflow: 'hidden',