[251103] fix: VoiceResponse Timer cleanup

🕐 커밋 시간: 2025. 11. 03. 21:04:40

📊 변경 통계:
  • 총 파일: 1개
  • 추가: +20줄
  • 삭제: -1줄

📝 수정된 파일:
  ~ com.twin.app.shoptime/src/views/SearchPanel/VoiceInputOverlay/modes/VoiceResponse.jsx
This commit is contained in:
2025-11-03 21:04:41 +09:00
parent 3601ce890b
commit b2360d2deb

View File

@@ -25,6 +25,8 @@ const VoiceResponse = ({ isLoading = true, query = '', searchId = '', onError =
const [currentMessageIndex, setCurrentMessageIndex] = useState(0);
const typingTimerRef = useRef(null);
const stageTimerRef = useRef(null);
const messageTimer1Ref = useRef(null);
const messageTimer2Ref = useRef(null);
// 🎯 빈 query 체크 - 빈 값이면 에러 상태로 처리
useEffect(() => {
@@ -61,6 +63,14 @@ const VoiceResponse = ({ isLoading = true, query = '', searchId = '', onError =
clearTimeout(stageTimerRef.current);
stageTimerRef.current = null;
}
if (messageTimer1Ref.current) {
clearTimeout(messageTimer1Ref.current);
messageTimer1Ref.current = null;
}
if (messageTimer2Ref.current) {
clearTimeout(messageTimer2Ref.current);
messageTimer2Ref.current = null;
}
setTypedText('');
setCurrentMessageIndex(0);
return;
@@ -71,7 +81,8 @@ const VoiceResponse = ({ isLoading = true, query = '', searchId = '', onError =
setCurrentMessageIndex(1);
setTypedText('');
}, 2000);
setTimeout(() => {
messageTimer1Ref.current = setTimeout(() => {
setCurrentMessageIndex(2);
setTypedText('');
}, 4000);
@@ -88,6 +99,14 @@ const VoiceResponse = ({ isLoading = true, query = '', searchId = '', onError =
clearTimeout(stageTimerRef.current);
stageTimerRef.current = null;
}
if (messageTimer1Ref.current) {
clearTimeout(messageTimer1Ref.current);
messageTimer1Ref.current = null;
}
if (messageTimer2Ref.current) {
clearTimeout(messageTimer2Ref.current);
messageTimer2Ref.current = null;
}
};
}, [isLoading]);