Explorar o código

fix: ts error

Dogtiti hai 1 ano
pai
achega
72d6f97024
Modificáronse 1 ficheiros con 5 adicións e 7 borrados
  1. 5 7
      app/components/artifact.tsx

+ 5 - 7
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(() => {