fix: comments would load incorrectly

This commit is contained in:
James Xylight committed 2025-02-05 20:36:27 -08:00
1 parent 14ba363c85
commit bd09390fba
3 files changed
+9 -4

No files matched your search

@@ -30,7 +30,7 @@
parseTags,
} from '$lib/components/lemmy/post/PostMeta.svelte'
import { Select, removeToast, toast } from 'mono-svelte'
import type { CommentSortType } from 'lemmy-js-client'
import type { CommentSortType, GetCommentsResponse } from 'lemmy-js-client'
import { profile } from '$lib/auth.svelte.js'
import { instance } from '$lib/instance.js'
import { afterNavigate, goto } from '$app/navigation'
@@ -433,8 +433,11 @@
{:else}
<CommentForm
postId={data.post.post_view.post.id}
oncomment={(comment) =>
(comments.comments = [comment.comment_view, ...comments.comments])}
oncomment={(comment) => {
comments.comments.push(comment.comment_view)
reloadComments()
toast({ content: $t('routes.post.commented'), type: 'success' })
}}
locked={(data.post.post_view.post.locked &&
!(
$profile?.user?.local_user_view.local_user.admin ||