mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-02 04:12:47 +02:00
Centralize chat session state sync with single subscription via atom
This commit is contained in:
parent
4cb835f19f
commit
39d434b00c
4 changed files with 48 additions and 18 deletions
15
surfsense_web/atoms/chat/chat-session-state.atom.ts
Normal file
15
surfsense_web/atoms/chat/chat-session-state.atom.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"use client";
|
||||
|
||||
import { atom } from "jotai";
|
||||
|
||||
export interface ChatSessionStateData {
|
||||
threadId: number;
|
||||
isAiResponding: boolean;
|
||||
respondingToUserId: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Global chat session state atom.
|
||||
* Updated by useChatSessionStateSync hook, read anywhere.
|
||||
*/
|
||||
export const chatSessionStateAtom = atom<ChatSessionStateData | null>(null);
|
||||
Loading…
Add table
Add a link
Reference in a new issue