diff --git a/langgraph/src/main.tsx b/langgraph/src/main.tsx index 78d8b81..4e9a398 100644 --- a/langgraph/src/main.tsx +++ b/langgraph/src/main.tsx @@ -95,6 +95,11 @@ function App() { return () => window.removeEventListener("open-canvas", handler); }, []); + // Clear error and stale stream state when thread switches + useEffect(() => { + thread.switchThread(currentThreadId); + }, [currentThreadId]); // eslint-disable-line react-hooks/exhaustive-deps + // Sync concurrent status with thread loading state useEffect(() => { if (!thread.isLoading && concurrentStatus !== "cancelling") {