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:
parent
055813205a
commit
a6352ec624
|
|
@ -9,10 +9,10 @@
|
||||||
* - Multi-layer anti-spam (cooldowns, confidence gating)
|
* - Multi-layer anti-spam (cooldowns, confidence gating)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
||||||
import { useLocale } from 'next-intl'
|
import { useLocale } from 'next-intl'
|
||||||
import { speakText, getLanguageForRegion, shouldShowAccentOption } from '../utils/speechSynthesis'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { getRandomPhrase, type FeedbackType } from '../utils/hotColdPhrases'
|
import { type FeedbackType, getRandomPhrase } from '../utils/hotColdPhrases'
|
||||||
|
import { getLanguageForRegion, shouldShowAccentOption, speakText } from '../utils/speechSynthesis'
|
||||||
import { useAvailableVoices } from './useSpeakHint'
|
import { useAvailableVoices } from './useSpeakHint'
|
||||||
|
|
||||||
// Map app locales to BCP 47 language tags for speech synthesis
|
// Map app locales to BCP 47 language tags for speech synthesis
|
||||||
|
|
@ -357,7 +357,8 @@ export function useHotColdFeedback({
|
||||||
const checkPosition = useCallback(
|
const checkPosition = useCallback(
|
||||||
({ cursorPosition, targetCenter, hoveredRegionId, cursorSvgPosition }: CheckPositionParams) => {
|
({ cursorPosition, targetCenter, hoveredRegionId, cursorSvgPosition }: CheckPositionParams) => {
|
||||||
if (!enabled || !targetCenter || !targetRegionId) return
|
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 now = performance.now()
|
||||||
const state = stateRef.current
|
const state = stateRef.current
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue