From: Dessalines Date: Thu, 13 Feb 2020 17:35:22 +0000 (-0500) Subject: Fix minor loading bug. X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%24%7B%60data:application/%22https:/hacktivis.me/README.es.md?a=commitdiff_plain;h=a27badefba3bdc46bd322358da5b2fd001b9e5cc;p=lemmy.git Fix minor loading bug. --- diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 384d5c1d..329168d2 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -613,11 +613,13 @@ export function createPostLikeFindRes(data: PostResponse, posts: Array) { } export function createPostLikeRes(data: PostResponse, post: Post) { - post.score = data.post.score; - post.upvotes = data.post.upvotes; - post.downvotes = data.post.downvotes; - if (data.post.my_vote !== null) { - post.my_vote = data.post.my_vote; + if (post) { + post.score = data.post.score; + post.upvotes = data.post.upvotes; + post.downvotes = data.post.downvotes; + if (data.post.my_vote !== null) { + post.my_vote = data.post.my_vote; + } } } @@ -629,9 +631,11 @@ export function editPostFindRes(data: PostResponse, posts: Array) { } export function editPostRes(data: PostResponse, post: Post) { - post.url = data.post.url; - post.name = data.post.name; - post.nsfw = data.post.nsfw; + if (post) { + post.url = data.post.url; + post.name = data.post.name; + post.nsfw = data.post.nsfw; + } } export function commentsToFlatNodes(