diff options
author | dan <dan.abramov@gmail.com> | 2024-02-20 21:39:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 21:39:42 +0000 |
commit | 6413b8ba8cbf73678d0f1687153b16f3a44f08b0 (patch) | |
tree | 7d264b534de4e975e01c19d3681a7f9242c2882a /src/state/queries | |
parent | 9edb82609d8ad9feede1fab460dd7daa553cc30e (diff) | |
download | voidsky-6413b8ba8cbf73678d0f1687153b16f3a44f08b0.tar.zst |
Fix flash when pressing into just-created post (#2945)
Diffstat (limited to 'src/state/queries')
-rw-r--r-- | src/state/queries/post-thread.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts index 56173207d..26d40599c 100644 --- a/src/state/queries/post-thread.ts +++ b/src/state/queries/post-thread.ts @@ -159,11 +159,18 @@ function responseToThreadNodes( AppBskyFeedPost.isRecord(node.post.record) && AppBskyFeedPost.validateRecord(node.post.record).success ) { + const post = node.post + // These should normally be present. They're missing only for + // posts that were *just* created. Ideally, the backend would + // know to return zeros. Fill them in manually to compensate. + post.replyCount ??= 0 + post.likeCount ??= 0 + post.repostCount ??= 0 return { type: 'post', _reactKey: node.post.uri, uri: node.post.uri, - post: node.post, + post: post, record: node.post.record, parent: node.parent && direction !== 'down' |