From 5c3f1f5d2fa408e253911762e792598cee86bb85 Mon Sep 17 00:00:00 2001 From: Josias Aurel Date: Mon, 13 May 2024 16:13:47 +0100 Subject: [PATCH] set the chat session id once when the chat is opened (#1674) --- src/components/popups-etc/chat-component.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/popups-etc/chat-component.tsx b/src/components/popups-etc/chat-component.tsx index d827478dca..b6fea71a11 100644 --- a/src/components/popups-etc/chat-component.tsx +++ b/src/components/popups-etc/chat-component.tsx @@ -6,6 +6,7 @@ import { Signal, useSignal } from "@preact/signals"; import { RiChatDeleteLine } from "react-icons/ri"; import markdown from "@wcj/markdown-to-html"; import { nanoid } from "nanoid"; +import { useState } from "preact/hooks"; interface ChatProps { persistenceState: Signal; @@ -46,7 +47,7 @@ Answer the questions that follow based on this unless new code is provided.`; const input = useSignal(""); const info = useSignal(""); - const chatSession = nanoid(10); + const [chatSession, _setChatSession] = useState(nanoid(10)); const email = persistenceState?.value?.session?.user.email; const sendMessage = async (message: string) => {