From 7c1bc1f1a1b071a12d9045612be3bddeb283beb4 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Thu, 25 Jul 2024 15:27:44 +0800 Subject: [PATCH] hotfix: auto set height --- app/components/artifact.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/artifact.tsx b/app/components/artifact.tsx index 78e928200..c06573b09 100644 --- a/app/components/artifact.tsx +++ b/app/components/artifact.tsx @@ -37,9 +37,7 @@ export function HTMLPreview(props: { const { id, height, title } = e.data; setTitle(title); if (id == frameId.current) { - if (height != iframeHeight + 40) { - setIframeHeight(height); - } + setIframeHeight(height); } }); }, [iframeHeight]); @@ -47,7 +45,9 @@ export function HTMLPreview(props: { const height = useMemo(() => { const parentHeight = props.height || 600; if (props.autoHeight !== false) { - return iframeHeight > parentHeight ? parentHeight : iframeHeight + 40; + return iframeHeight + 40 > parentHeight + ? parentHeight + : iframeHeight + 40; } else { return parentHeight; }