fix(know-your-world): fix hot/cold visual feedback delay

Remove early return that was blocking visual feedback when speech was active.
Previously, `if (isSpeaking || externalSpeaking) return` blocked BOTH visual
AND audio feedback. Now visual feedback (spinning crosshair) updates immediately
while audio feedback is still properly gated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-12-04 13:31:20 -06:00
parent 055813205a
commit a6352ec624
1 changed files with 5 additions and 4 deletions

View File

@ -9,10 +9,10 @@
* - Multi-layer anti-spam (cooldowns, confidence gating)
*/
import { useCallback, useEffect, useRef, useState } from 'react'
import { useLocale } from 'next-intl'
import { speakText, getLanguageForRegion, shouldShowAccentOption } from '../utils/speechSynthesis'
import { getRandomPhrase, type FeedbackType } from '../utils/hotColdPhrases'
import { useCallback, useEffect, useRef, useState } from 'react'
import { type FeedbackType, getRandomPhrase } from '../utils/hotColdPhrases'
import { getLanguageForRegion, shouldShowAccentOption, speakText } from '../utils/speechSynthesis'
import { useAvailableVoices } from './useSpeakHint'
// Map app locales to BCP 47 language tags for speech synthesis
@ -357,7 +357,8 @@ export function useHotColdFeedback({
const checkPosition = useCallback(
({ cursorPosition, targetCenter, hoveredRegionId, cursorSvgPosition }: CheckPositionParams) => {
if (!enabled || !targetCenter || !targetRegionId) return
if (isSpeaking || externalSpeaking) return
// Note: We no longer block visual feedback when speaking - only audio gates should prevent speech
// The old code had `if (isSpeaking || externalSpeaking) return` here which blocked BOTH visual and audio
const now = performance.now()
const state = stateRef.current