diff options
| author | cashmere <cashmere@autistici.org> | 2026-07-26 22:34:11 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-07-26 22:34:11 +0200 |
| commit | 4b6caee158a4913f9fda423e4df7f9df2e8a53a0 (patch) | |
| tree | c8a7a2947f96ae264650fa3f5b56e36a34db704c /apps/web/src/components/editor/panels | |
| parent | db3c7eee7e65831394787c47fbd41a4024537de4 (diff) | |
| download | opencut-4b6caee158a4913f9fda423e4df7f9df2e8a53a0.tar.gz | |
fix: guard MediaPreview against image assets without url
The image branch rendered <Image src={item.url ?? ""}>, crashing the
assets panel for any image asset lacking url. It now falls back to
thumbnailUrl and then to the existing MediaTypePlaceholder, mirroring the
video branch's fallback.
Diffstat (limited to 'apps/web/src/components/editor/panels')
| -rw-r--r-- | apps/web/src/components/editor/panels/assets/views/assets.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/web/src/components/editor/panels/assets/views/assets.tsx b/apps/web/src/components/editor/panels/assets/views/assets.tsx index 00cb015f..4dbed41e 100644 --- a/apps/web/src/components/editor/panels/assets/views/assets.tsx +++ b/apps/web/src/components/editor/panels/assets/views/assets.tsx @@ -444,10 +444,21 @@ function MediaPreview({ const shouldShowDurationBadge = variant === "grid"; if (item.type === "image") { + const src = item.url ?? item.thumbnailUrl; + if (!src) { + return ( + <MediaTypePlaceholder + icon={Image02Icon} + label="Image" + duration={item.duration} + variant="muted" + /> + ); + } return ( <div className="relative flex size-full items-center justify-center bg-muted"> <Image - src={item.url ?? ""} + src={src} alt={item.name} fill sizes="100vw" |
