add check
This commit is contained in:
parent
a5ae274c3e
commit
7f0a902d04
|
@ -54,13 +54,12 @@ export const CommentsTree = (props: { shoutSlug: string }) => {
|
|||
}
|
||||
onMount(async () => await loadMore())
|
||||
|
||||
function nestComments(commentList) {
|
||||
const nestComments = (commentList) => {
|
||||
const commentMap = {}
|
||||
commentList.forEach((comment) => {
|
||||
commentMap[comment.id] = comment
|
||||
if (comment.replyTo) {
|
||||
if (!comment.replyTo) return
|
||||
const parent = commentMap[comment.replyTo]
|
||||
if (comment.replyTo !== null) {
|
||||
const parent = commentMap[comment.replyTo] ?? []
|
||||
;(parent.children = parent.children || []).push(comment)
|
||||
}
|
||||
})
|
||||
|
@ -69,10 +68,6 @@ export const CommentsTree = (props: { shoutSlug: string }) => {
|
|||
})
|
||||
}
|
||||
|
||||
createEffect(() => {
|
||||
console.log('!!! reactions():', nestComments(reactions()))
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
<Show when={!isCommentsLoading()} fallback={<Loading />}>
|
||||
|
|
Loading…
Reference in New Issue
Block a user