Skip to content

Commit 7c1bc1f

Browse files
committed
hotfix: auto set height
1 parent 763fc89 commit 7c1bc1f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/components/artifact.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ export function HTMLPreview(props: {
3737
const { id, height, title } = e.data;
3838
setTitle(title);
3939
if (id == frameId.current) {
40-
if (height != iframeHeight + 40) {
41-
setIframeHeight(height);
42-
}
40+
setIframeHeight(height);
4341
}
4442
});
4543
}, [iframeHeight]);
4644

4745
const height = useMemo(() => {
4846
const parentHeight = props.height || 600;
4947
if (props.autoHeight !== false) {
50-
return iframeHeight > parentHeight ? parentHeight : iframeHeight + 40;
48+
return iframeHeight + 40 > parentHeight
49+
? parentHeight
50+
: iframeHeight + 40;
5151
} else {
5252
return parentHeight;
5353
}

0 commit comments

Comments
 (0)