From c499bfb4ed03c7ad58e13a9bc43daa12d476ae08 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Mon, 18 May 2026 22:54:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20voice=20provider=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/state/AppState.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/state/AppState.tsx b/src/state/AppState.tsx index 41119c108..98ea9588c 100644 --- a/src/state/AppState.tsx +++ b/src/state/AppState.tsx @@ -11,11 +11,24 @@ import { applySettingsChange } from '../utils/settings/applySettingsChange.js'; import type { SettingSource } from '../utils/settings/constants.js'; import { createStore } from './store.js'; -// DCE: voice context is ant-only. External builds get a passthrough. +// DCE: voice context is ant-only. External builds get a noop provider that +// still wraps children in VoiceContext so useVoiceState never throws. /* eslint-disable @typescript-eslint/no-require-imports */ const VoiceProvider: (props: { children: React.ReactNode }) => React.ReactNode = feature('VOICE_MODE') ? require('../context/voice.js').VoiceProvider - : ({ children }) => children; + : (() => { + const { VoiceContext } = require('../context/voice.js'); + const noopStore = createStore({ + voiceState: 'idle' as const, + voiceError: null as string | null, + voiceInterimTranscript: '', + voiceAudioLevels: [] as number[], + voiceWarmingUp: false, + }); + return ({ children }: { children: React.ReactNode }) => ( + {children} + ); + })(); /* eslint-enable @typescript-eslint/no-require-imports */ import { type AppState, type AppStateStore, getDefaultAppState } from './AppStateStore.js';