From 4f051715bfcd229f7e4c5c344c50e78eda9eb2a1 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Tue, 31 Mar 2026 16:31:14 +0800 Subject: [PATCH] =?UTF-8?q?folder=E7=AA=97=E5=8F=A3=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contexts/acp-connections-context.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/contexts/acp-connections-context.tsx b/src/contexts/acp-connections-context.tsx index 31d3b7a..448f0c2 100644 --- a/src/contexts/acp-connections-context.tsx +++ b/src/contexts/acp-connections-context.tsx @@ -1778,7 +1778,11 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) { }) .then((fn) => { if (cancelled) { - fn() + try { + fn() + } catch { + // Tauri listener may not be fully registered yet + } } else { unlisten = fn listenerReadyRef.current = true @@ -1798,7 +1802,11 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) { clearTimeout(flushTimerRef.current) flushTimerRef.current = null } - unlisten?.() + try { + unlisten?.() + } catch { + // Tauri listener may not be fully registered yet + } } }, [bufferUnmappedEvent, handleMappedEvent, resolveListenerReadyWaiters])