fix: view wont update on new comments, close #611
This commit is contained in:
2 files changed
+7
-7
No files matched your search
@@ -38,7 +38,7 @@
|
||||
|
||||
let {
|
||||
post,
|
||||
comments: passedComments,
|
||||
comments,
|
||||
sort = $bindable(),
|
||||
onupdate,
|
||||
focus,
|
||||
@@ -46,8 +46,6 @@
|
||||
}: Props = $props()
|
||||
let commenting = $state(false)
|
||||
|
||||
let comments = $derived(passedComments)
|
||||
|
||||
let tree = $state(buildCommentsTree(comments.comments))
|
||||
$effect(() => {
|
||||
tree = buildCommentsTree(comments.comments)
|
||||
@@ -120,7 +118,7 @@
|
||||
<CommentForm
|
||||
postId={post.post_view.post.id}
|
||||
oncomment={comment => {
|
||||
comments.comments.push(comment.comment_view)
|
||||
comments.comments.unshift(comment.comment_view)
|
||||
}}
|
||||
onfocus={() => (commenting = true)}
|
||||
tools={commenting}
|
||||
|
||||
Reference in new issue
Block a user