From bbfed5f67edeaeaab9ce5a740ba793dba891b89a Mon Sep 17 00:00:00 2001 From: Jack Bridger Date: Wed, 14 Jan 2026 18:06:28 +0000 Subject: [PATCH] fix: await unmute() to ensure VAD reinitializes before continuing The unmute() function in the JS SDK is async because it needs to reinitialize VAD. Not awaiting it could cause race conditions where user speech isn't detected immediately after unmuting. Co-Authored-By: Claude Opus 4.5 --- src/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 95e3609..72539b6 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -320,12 +320,12 @@ const useLayercodeAgent = ( clientRef.current.mute(); }, []); - const unmute = useCallback(() => { + const unmute = useCallback(async () => { if (!clientRef.current) { console.warn('[Layercode] unmute() called but no client exists. Did you call connect() first?'); return; } - clientRef.current.unmute(); + await clientRef.current.unmute(); }, []); const setAudioInput = useCallback(