From fc32008e91049d2ba598d34d6c438c139cd353b9 Mon Sep 17 00:00:00 2001 From: Ryan Hopper-Lowe Date: Mon, 9 Sep 2024 12:15:06 -0500 Subject: [PATCH] fix: prevent double refresh when switching threads --- contexts/chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contexts/chat.tsx b/contexts/chat.tsx index 65fd6cc..d68ce05 100644 --- a/contexts/chat.tsx +++ b/contexts/chat.tsx @@ -137,8 +137,8 @@ const ChatContextProvider: React.FC = ({ setThread(id); setScriptContent((await getScript(scriptId))?.script || []); setScriptId(scriptId); + // use `setForceRun` instead of `setShouldRestart` because it triggers the `run` WS event which will reset the messages as well setForceRun(true); - setShouldRestart(true); } };