diff --git a/src/components/MediaPreview.tsx b/src/components/MediaPreview.tsx index 6e368e7dcc..208973cc95 100644 --- a/src/components/MediaPreview.tsx +++ b/src/components/MediaPreview.tsx @@ -54,6 +54,14 @@ export function Embed({ ) + } else if ( + e.type === 'post_with_media' && + // ignore further "nested" RecordWithMedia + e.media.type !== 'post_with_media' && + // ignore any unknowns + e.media.view !== null + ) { + return } return null diff --git a/src/types/bsky/post.ts b/src/types/bsky/post.ts index 225726f41c..61b63dce7e 100644 --- a/src/types/bsky/post.ts +++ b/src/types/bsky/post.ts @@ -1,4 +1,5 @@ import { + $Typed, AppBskyEmbedExternal, AppBskyEmbedImages, AppBskyEmbedRecord, @@ -12,47 +13,47 @@ import { export type Embed = | { type: 'post' - view: AppBskyEmbedRecord.ViewRecord + view: $Typed } | { type: 'post_not_found' - view: AppBskyEmbedRecord.ViewNotFound + view: $Typed } | { type: 'post_blocked' - view: AppBskyEmbedRecord.ViewBlocked + view: $Typed } | { type: 'post_detached' - view: AppBskyEmbedRecord.ViewDetached + view: $Typed } | { type: 'feed' - view: AppBskyFeedDefs.GeneratorView + view: $Typed } | { type: 'list' - view: AppBskyGraphDefs.ListView + view: $Typed } | { type: 'labeler' - view: AppBskyLabelerDefs.LabelerView + view: $Typed } | { type: 'starter_pack' - view: AppBskyGraphDefs.StarterPackViewBasic + view: $Typed } | { type: 'images' - view: AppBskyEmbedImages.View + view: $Typed } | { type: 'link' - view: AppBskyEmbedExternal.View + view: $Typed } | { type: 'video' - view: AppBskyEmbedVideo.View + view: $Typed } | { type: 'post_with_media'