mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 02:23:53 +02:00
Restore API-based comments and remove unstable live sync integration
This commit is contained in:
parent
f346726294
commit
3ab9cc8485
5 changed files with 22 additions and 55 deletions
|
|
@ -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 [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue