Reply composer skele

This commit is contained in:
Eric Bailey
2025-06-05 11:21:54 -05:00
parent b8ab1aec83
commit 6926b852ab
3 changed files with 56 additions and 8 deletions
+22 -8
View File
@@ -406,10 +406,10 @@ export function buildThread({
if (isLoading) {
const anchorPost = items.at(0)
const skeletonReplies =
anchorPost && anchorPost.type === 'threadPost'
? anchorPost?.value.post.replyCount ?? 4
: 4
const hasAnchorFromCache = anchorPost && anchorPost.type === 'threadPost'
const skeletonReplies = hasAnchorFromCache
? anchorPost.value.post.replyCount ?? 4
: 4
if (!items.length) {
items.push(
@@ -421,10 +421,24 @@ export function buildThread({
}
if (hasSession) {
items.push({
type: 'replyComposer',
key: 'replyComposer',
})
// we might have this from cache
const replyDisabled =
hasAnchorFromCache &&
anchorPost.value.post.viewer?.replyDisabled === true
if (hasAnchorFromCache && !replyDisabled) {
items.push({
type: 'replyComposer',
key: 'replyComposer',
})
} else {
items.push(
views.skeleton({
key: 'replyComposer',
item: 'replyComposer',
}),
)
}
}
for (let i = 0; i < skeletonReplies; i++) {