Don't mutate post in shadow
This commit is contained in:
Vendored
+3
-1
@@ -91,6 +91,7 @@ function mergeShadow(
|
|||||||
repostCount = Math.max(0, repostCount)
|
repostCount = Math.max(0, repostCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let embed: typeof post.embed
|
||||||
if ('embed' in shadow) {
|
if ('embed' in shadow) {
|
||||||
if (
|
if (
|
||||||
(AppBskyEmbedRecord.isView(post.embed) &&
|
(AppBskyEmbedRecord.isView(post.embed) &&
|
||||||
@@ -98,12 +99,13 @@ function mergeShadow(
|
|||||||
(AppBskyEmbedRecordWithMedia.isView(post.embed) &&
|
(AppBskyEmbedRecordWithMedia.isView(post.embed) &&
|
||||||
AppBskyEmbedRecordWithMedia.isView(shadow.embed))
|
AppBskyEmbedRecordWithMedia.isView(shadow.embed))
|
||||||
) {
|
) {
|
||||||
post.embed = shadow.embed
|
embed = shadow.embed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return castAsShadow({
|
return castAsShadow({
|
||||||
...post,
|
...post,
|
||||||
|
embed,
|
||||||
likeCount: likeCount,
|
likeCount: likeCount,
|
||||||
repostCount: repostCount,
|
repostCount: repostCount,
|
||||||
viewer: {
|
viewer: {
|
||||||
|
|||||||
Reference in New Issue
Block a user