"use client"; /** * Which conversation the chat screen is currently showing, for surfaces * outside the chat route (the sidebar list highlights it). A tiny external * store instead of reading `?c=` from the URL, because the sidebar renders on * every page and `useSearchParams` there would force pages dynamic. */ let active: string | null = null; const listeners = new Set<() => void>(); export const chatActive = { set(id: string | null): void { if (active === id) return; active = id; listeners.forEach((listener) => listener()); }, subscribe(listener: () => void): () => void { listeners.add(listener); return () => listeners.delete(listener); }, getSnapshot(): string | null { return active; }, getServerSnapshot(): string | null { return null; }, };