From 8d4b06277b65ebe09f44255d87c807522e1fe843 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Fri, 23 Dec 2022 10:08:17 +0300 Subject: [PATCH] [WiP] createReaction debug --- src/components/Article/Comment.tsx | 7 ++----- src/components/Article/CommentsTree.tsx | 23 +---------------------- src/utils/apiClient.ts | 5 ++--- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/components/Article/Comment.tsx b/src/components/Article/Comment.tsx index f7f0b1a0..ec3ba0bc 100644 --- a/src/components/Article/Comment.tsx +++ b/src/components/Article/Comment.tsx @@ -41,10 +41,10 @@ export default (props: Props) => { event.preventDefault() // await createReaction({ await apiClient.createReaction({ - kind: 7, replyTo: props.parent, body: postMessageText(), - shout: comment().shout.slug + shout: comment().shout.slug, + kind: 7 }) } const formattedDate = createMemo(() => @@ -168,9 +168,6 @@ export default (props: Props) => { - - - ) } diff --git a/src/components/Article/CommentsTree.tsx b/src/components/Article/CommentsTree.tsx index 02e2ad60..6ed45c06 100644 --- a/src/components/Article/CommentsTree.tsx +++ b/src/components/Article/CommentsTree.tsx @@ -53,24 +53,6 @@ export const CommentsTree = (props: { shoutSlug: string }) => { } onMount(async () => await loadMore()) - const nestComments = (commentList) => { - const commentMap = {} - commentList.forEach((comment) => { - commentMap[comment.id] = comment - if (comment.replyTo !== null) { - const parent = commentMap[comment.replyTo] ?? [] - ;(parent.children = parent.children || []).push(comment) - } - }) - return commentList.filter((comment) => { - return !comment.replyTo - }) - } - - createEffect(() => { - console.log('!!! re:', nestComments(reactions())) - }) - return ( <> }> @@ -106,16 +88,13 @@ export const CommentsTree = (props: { shoutSlug: string }) => {