fix(P0): 修复发送消息后主区域跳回欢迎屏
Trigger auto deployment for soc-langgraph / build-and-deploy (push) Has been cancelled
Deploy LangGraph UI to Azure Static Web Apps / build-and-deploy (push) Has been cancelled

This commit is contained in:
gongzhiyong
2026-04-15 02:49:41 +08:00
parent b548ed4f19
commit 96aafcebac
+4 -5
View File
@@ -98,7 +98,7 @@ function App() {
}, []);
// Clear error and stale stream state when thread switches.
// Skip when doSubmit already called switchThread manually (to avoid clearing mid-stream).
// Skip when doSubmit set the flag (new thread created during submit — don't clear mid-stream).
useEffect(() => {
if (skipNextSwitchRef.current) {
skipNextSwitchRef.current = false;
@@ -217,12 +217,11 @@ function App() {
setConcurrentStatus("idle");
return;
}
// Only need to switchThread manually when a new thread was just created.
// For existing threads, currentThreadId didn't change so useEffect won't fire.
// Setting the skip flag prevents the useEffect from re-firing and clearing messages.
// For a newly created thread, currentThreadId just changed so the useEffect
// would call thread.switchThread() which clears thread.messages mid-stream.
// Skip it — useStream already uses the updated threadId prop from currentThreadId.
if (!currentThreadId) {
skipNextSwitchRef.current = true;
thread.switchThread(activeThreadId);
}
try { localStorage.removeItem(`draft_${activeThreadId}`); } catch { /* ignore */ }