From c46becd1caf60306ed22bed16597402c3c96f9c5 Mon Sep 17 00:00:00 2001 From: Abhijay007 Date: Wed, 7 Jan 2026 18:04:44 +0000 Subject: [PATCH 1/2] fix(ui): respect width parameter in MCP app size-changed notifications Signed-off-by: Abhijay007 --- ui/desktop/src/components/McpApps/McpAppRenderer.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/desktop/src/components/McpApps/McpAppRenderer.tsx b/ui/desktop/src/components/McpApps/McpAppRenderer.tsx index 3d337ed1a32b..b56501cc69ab 100644 --- a/ui/desktop/src/components/McpApps/McpAppRenderer.tsx +++ b/ui/desktop/src/components/McpApps/McpAppRenderer.tsx @@ -60,6 +60,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) { @@ -199,9 +200,12 @@ 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); + if (width !== undefined) { + setIframeWidth(width); + } }, []); const { iframeRef, proxyUrl } = useSandboxBridge({ @@ -263,7 +267,7 @@ export default function McpAppRenderer({ ref={iframeRef} src={proxyUrl} style={{ - width: '100%', + width: iframeWidth ? `${iframeWidth}px` : '100%', height: `${iframeHeight}px`, border: 'none', overflow: 'hidden', From 5b85174d95e8fe610a84fb0d43364b5dc5af5794 Mon Sep 17 00:00:00 2001 From: Abhijay007 Date: Tue, 27 Jan 2026 14:47:33 +0000 Subject: [PATCH 2/2] refactor: addressed comments Signed-off-by: Abhijay007 --- ui/desktop/src/components/McpApps/McpAppRenderer.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/desktop/src/components/McpApps/McpAppRenderer.tsx b/ui/desktop/src/components/McpApps/McpAppRenderer.tsx index b56501cc69ab..6004879c442a 100644 --- a/ui/desktop/src/components/McpApps/McpAppRenderer.tsx +++ b/ui/desktop/src/components/McpApps/McpAppRenderer.tsx @@ -203,9 +203,7 @@ export default function McpAppRenderer({ const handleSizeChanged = useCallback((height: number, width?: number) => { const newHeight = Math.max(DEFAULT_IFRAME_HEIGHT, height); setIframeHeight(newHeight); - if (width !== undefined) { - setIframeWidth(width); - } + setIframeWidth(width ?? null); }, []); const { iframeRef, proxyUrl } = useSandboxBridge({ @@ -268,6 +266,7 @@ export default function McpAppRenderer({ src={proxyUrl} style={{ width: iframeWidth ? `${iframeWidth}px` : '100%', + maxWidth: '100%', height: `${iframeHeight}px`, border: 'none', overflow: 'hidden',