Restore API-based comments and remove unstable live sync integration

This commit is contained in:
CREDO23 2026-01-22 15:05:00 +02:00
parent f346726294
commit 3ab9cc8485
5 changed files with 22 additions and 55 deletions

View file

@ -10,7 +10,7 @@ import {
} from "@/atoms/chat-comments/comments-mutation.atoms";
import { membersAtom } from "@/atoms/members/members-query.atoms";
import { currentUserAtom } from "@/atoms/user/user-query.atoms";
import { useCommentsLive } from "@/hooks/use-comments-live";
import { useComments } from "@/hooks/use-comments";
import { CommentPanel } from "../comment-panel/comment-panel";
import type { CommentPanelContainerProps } from "./types";
import { transformComment, transformMember } from "./utils";
@ -21,10 +21,10 @@ export function CommentPanelContainer({
maxHeight,
variant = "desktop",
}: CommentPanelContainerProps) {
// Live sync for real-time comment updates
const { comments: liveComments, isLoading: isCommentsLoading } = useCommentsLive(
isOpen ? messageId : null
);
const { data: commentsData, isLoading: isCommentsLoading } = useComments({
messageId,
enabled: isOpen,
});
const [{ data: membersData, isLoading: isMembersLoading }] = useAtom(membersAtom);
const [{ data: currentUser }] = useAtom(currentUserAtom);
@ -35,8 +35,9 @@ export function CommentPanelContainer({
const [{ mutate: deleteComment, isPending: isDeleting }] = useAtom(deleteCommentMutationAtom);
const commentThreads = useMemo(() => {
return liveComments.map(transformComment);
}, [liveComments]);
if (!commentsData?.comments) return [];
return commentsData.comments.map(transformComment);
}, [commentsData]);
const members = useMemo(() => {
if (!membersData) return [];