From 72d6f970241e9390c9c4027f49718ff8afe593dd Mon Sep 17 00:00:00 2001 From: Dogtiti <499960698@qq.com> Date: Fri, 26 Jul 2024 11:21:51 +0800 Subject: [PATCH] fix: ts error --- app/components/artifact.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/components/artifact.tsx b/app/components/artifact.tsx index 3006fe012..2cb44d6cd 100644 --- a/app/components/artifact.tsx +++ b/app/components/artifact.tsx @@ -48,14 +48,12 @@ export function HTMLPreview(props: { }, []); const height = useMemo(() => { - const parentHeight = props.height || 600; - if (props.autoHeight !== false) { - return iframeHeight + 40 > parentHeight - ? parentHeight - : iframeHeight + 40; - } else { - return parentHeight; + if (!props.autoHeight) return props.height || 600; + if (typeof props.height === "string") { + return props.height; } + const parentHeight = props.height || 600; + return iframeHeight + 40 > parentHeight ? parentHeight : iframeHeight + 40; }, [props.autoHeight, props.height, iframeHeight]); const srcDoc = useMemo(() => {