fix(chat): update navigation method to prevent state loss during thread remount (#1107)

This commit is contained in:
JeffJiang
2026-03-12 14:57:17 +08:00
committed by GitHub
parent e5a21b9ba0
commit fdacb1c3a5
3 changed files with 4 additions and 27 deletions
@@ -43,6 +43,7 @@ export default function AgentChatPage() {
context: { ...settings.context, agent_name: agent_name },
onStart: () => {
setIsNewThread(false);
// ! Important: Never use next.js router for navigation in this case, otherwise it will cause the thread to re-mount and lose all states. Use native history API instead.
history.replaceState(
null,
"",