From 75445a0c66e2ac8b754ce2ba8bf68f1eef162ced Mon Sep 17 00:00:00 2001 From: Lance Mao Date: Tue, 23 Jul 2024 17:24:29 +0800 Subject: [PATCH] fix audio not working during development due to react's useEffect wil be triggered twice (#6126) --- web/app/components/base/voice-input/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/app/components/base/voice-input/index.tsx b/web/app/components/base/voice-input/index.tsx index b42e3b849e..07b3c5ddcf 100644 --- a/web/app/components/base/voice-input/index.tsx +++ b/web/app/components/base/voice-input/index.tsx @@ -152,6 +152,10 @@ const VoiceInput = ({ useEffect(() => { initCanvas() handleStartRecord() + const recorderRef = recorder?.current + return () => { + recorderRef?.stop() + } }, []) const minutes = parseInt(`${parseInt(`${originDuration}`) / 60}`)