GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — claude-code-source-code/src/hooks/useVoiceEnabled.ts at main · chaoswork/claude-code-source-code Expand file tree/ Copy pathuseVoiceEnabled.tsMore file actions 25 lines (24 loc) · 1.11 KB / Copy pathuseVoiceEnabled.tsFile metadata and controls25 lines (24 loc) · 1.11 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import { useMemo } from 'react' import { useAppState } from '../state/AppState.js' import { hasVoiceAuth, isVoiceGrowthBookEnabled, } from '../voice/voiceModeEnabled.js' /** * Combines user intent (settings.voiceEnabled) with auth + GB kill-switch. * Only the auth half is memoized on authVersion — it's the expensive one * (cold getClaudeAIOAuthTokens memoize → sync `security` spawn, ~60ms/call, * ~180ms total in profile v5 when token refresh cleared the cache mid-session). * GB is a cheap cached-map lookup and stays outside the memo so a mid-session * kill-switch flip still takes effect on the next render. * * authVersion bumps on /login only. Background token refresh leaves it alone * (user is still authed), so the auth memo stays correct without re-eval. */ export function useVoiceEnabled(): boolean { const userIntent = useAppState(s => s.settings.voiceEnabled === true) const authVersion = useAppState(s => s.authVersion) // eslint-disable-next-line react-hooks/exhaustive-deps const authed = useMemo(hasVoiceAuth, [authVersion]) return userIntent && authed && isVoiceGrowthBookEnabled() } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |