Skip to content

Commit

Permalink
Don't validate embeds when traversing cache (#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Dec 11, 2023
1 parent 0f7dbbb commit 52ffd6a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/state/queries/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,18 @@ export function truncateAndInvalidate<T = any>(
export function getEmbeddedPost(
v: unknown,
): AppBskyEmbedRecord.ViewRecord | undefined {
if (
AppBskyEmbedRecord.isView(v) &&
AppBskyEmbedRecord.validateView(v).success
) {
if (AppBskyEmbedRecord.isView(v)) {
if (
AppBskyEmbedRecord.isViewRecord(v.record) &&
AppBskyFeedPost.isRecord(v.record.value) &&
AppBskyFeedPost.validateRecord(v.record.value).success
AppBskyFeedPost.isRecord(v.record.value)
) {
return v.record
}
}
if (
AppBskyEmbedRecordWithMedia.isView(v) &&
AppBskyEmbedRecordWithMedia.validateView(v).success
) {
if (AppBskyEmbedRecordWithMedia.isView(v)) {
if (
AppBskyEmbedRecord.isViewRecord(v.record.record) &&
AppBskyFeedPost.isRecord(v.record.record.value) &&
AppBskyFeedPost.validateRecord(v.record.record.value).success
AppBskyFeedPost.isRecord(v.record.record.value)
) {
return v.record.record
}
Expand Down

0 comments on commit 52ffd6a

Please sign in to comment.