mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
Add thread-level Electric sync for comments, remove per-message hooks
This commit is contained in:
parent
4b57ba9d2b
commit
0b8fed7304
3 changed files with 365 additions and 154 deletions
|
|
@ -62,6 +62,7 @@ import type { ThinkingStep } from "@/components/tool-ui/deepagent-thinking";
|
|||
import { Button } from "@/components/ui/button";
|
||||
import type { Document } from "@/contracts/types/document.types";
|
||||
import { useChatSessionState } from "@/hooks/use-chat-session-state";
|
||||
import { useCommentsElectric } from "@/hooks/use-comments-electric";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface ThreadProps {
|
||||
|
|
@ -238,6 +239,9 @@ const Composer: FC = () => {
|
|||
const { isAiResponding, respondingToUserId } = useChatSessionState(threadId);
|
||||
const isBlockedByOtherUser = isAiResponding && respondingToUserId !== currentUser?.id;
|
||||
|
||||
// Sync comments for the entire thread via Electric SQL (one subscription per thread)
|
||||
useCommentsElectric(threadId);
|
||||
|
||||
// Auto-focus editor on new chat page after mount
|
||||
useEffect(() => {
|
||||
if (isThreadEmpty && !hasAutoFocusedRef.current && editorRef.current) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue