Merge pull request #338 from SableClient/fix-image-render

Fix images not rendering when dimensions aren't present
This commit is contained in:
7w1 authored and GitHub committed 2026-03-17 12:45:55 -05:00
commit 9fa328dd12
2 files changed
+18 -1

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
default: patch
---
Fix images without explicit dimensions not appearing.
@@ -65,6 +65,7 @@ export const ImageContent = as<'div', ImageContentProps>(
(
{
className,
style,
body,
mimeType,
url,
@@ -122,9 +123,15 @@ export const ImageContent = as<'div', ImageContentProps>(
if (autoPlay) loadSrc();
}, [autoPlay, loadSrc]);
const hasDimensions = typeof info?.w === 'number' && typeof info?.h === 'number';
return (
<Box
className={classNames(css.RelativeBase, className)}
style={{
...(hasDimensions ? { aspectRatio: `${info.w} / ${info.h}` } : { minHeight: '150px' }),
...style,
}}
{...props}
ref={ref}
onPointerEnter={() => setIsHovered(true)}
@@ -185,7 +192,12 @@ export const ImageContent = as<'div', ImageContentProps>(
</Box>
)}
{srcState.status === AsyncStatus.Success && (
<Box className={classNames(css.AbsoluteContainer, blurred && css.Blur)}>
<Box
className={classNames(
hasDimensions ? css.AbsoluteContainer : undefined,
blurred && css.Blur
)}
>
{renderImage({
alt: body,
title: body,