修复活跃的对话中会话在关闭会话tab后连接被自动回收了
This commit is contained in:
@@ -266,9 +266,14 @@ export function useConnectionLifecycle({
|
||||
|
||||
// Clean up on unmount (e.g. tab closed): disconnect the ACP connection
|
||||
// so it doesn't leak, and remove lingering tasks.
|
||||
// However, if the agent is actively prompting (generating a response),
|
||||
// keep it alive so it can finish in the background — the idle sweep
|
||||
// will clean it up once it transitions back to "connected".
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
connDisconnectRef.current().catch(() => {})
|
||||
if (statusRef.current !== "prompting") {
|
||||
connDisconnectRef.current().catch(() => {})
|
||||
}
|
||||
if (taskIdRef.current) {
|
||||
removeTask(taskIdRef.current)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user