feat: Fix commenting issue

This commit is contained in:
Xyphyn committed 2023-07-05 14:36:17 -07:00
1 parent d9812b17bd
commit dd30acf19d
5 files changed
+16 -6

No files matched your search

@@ -159,7 +159,14 @@
{postId}
parentId={node.comment_view.comment.id}
on:comment={(e) => {
node.children = [e.detail, ...node.children]
node.children = [
{
children: [],
depth: node.depth,
comment_view: e.detail.comment_view,
},
...node.children,
]
replying = false
}}
/>
@@ -1,7 +1,7 @@
<script lang="ts">
import Button from '$lib/components/input/Button.svelte'
import { Color } from '$lib/ui/colors.js'
import type { Comment, Post } from 'lemmy-js-client'
import type { CommentResponse } from 'lemmy-js-client'
import { authData, getClient, user } from '$lib/lemmy.js'
import { createEventDispatcher } from 'svelte'
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
@@ -9,7 +9,7 @@
export let postId: number
export let parentId: number | undefined = undefined
const dispatch = createEventDispatcher()
const dispatch = createEventDispatcher<{ comment: CommentResponse }>()
let newComment = ''
let loading = false
@@ -35,6 +35,7 @@
ToastType.success
)
} catch (err) {
console.error(err)
addToast(
'Error',
'Failed to comment. (Sometimes this error appears even when successful.)',