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

@@ -258,6 +258,7 @@
children: [], children: [],
comment_view: e.comment_view, comment_view: e.comment_view,
depth: node.depth + 1, depth: node.depth + 1,
expanded: true,
}, },
...node.children, ...node.children,
] ]
+2 -1
View File
@@ -273,7 +273,8 @@
"emptyComments": { "emptyComments": {
"title": "No comments", "title": "No comments",
"description": "Start the conversation!" "description": "Start the conversation!"
} },
"commented": "Your comment was posted."
}, },
"inbox": { "inbox": {
"title": "Inbox", "title": "Inbox",
@@ -30,7 +30,7 @@
parseTags, parseTags,
} from '$lib/components/lemmy/post/PostMeta.svelte' } from '$lib/components/lemmy/post/PostMeta.svelte'
import { Select, removeToast, toast } from 'mono-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 { profile } from '$lib/auth.svelte.js'
import { instance } from '$lib/instance.js' import { instance } from '$lib/instance.js'
import { afterNavigate, goto } from '$app/navigation' import { afterNavigate, goto } from '$app/navigation'
@@ -433,8 +433,11 @@
{:else} {:else}
<CommentForm <CommentForm
postId={data.post.post_view.post.id} postId={data.post.post_view.post.id}
oncomment={(comment) => oncomment={(comment) => {
(comments.comments = [comment.comment_view, ...comments.comments])} comments.comments.push(comment.comment_view)
reloadComments()
toast({ content: $t('routes.post.commented'), type: 'success' })
}}
locked={(data.post.post_view.post.locked && locked={(data.post.post_view.post.locked &&
!( !(
$profile?.user?.local_user_view.local_user.admin || $profile?.user?.local_user_view.local_user.admin ||