Centralize chat session state sync with single subscription via atom

This commit is contained in:
CREDO23 2026-01-22 19:04:23 +02:00
parent 4cb835f19f
commit 39d434b00c
4 changed files with 48 additions and 18 deletions

View 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);