fix(app): keep dictation shortcuts responsive (#2268)
The composer mirrored dictation state in a second ref that could remain stale after the recording surface changed. Route shortcut decisions through the dictation lifecycle's synchronous state so finishing or rejecting a recording cannot leave Command-D latched.
This commit is contained in:
@@ -15,6 +15,7 @@ export interface UseDictationOptions {
|
||||
|
||||
export interface UseDictationResult {
|
||||
isRecording: boolean;
|
||||
isRecordingActive: () => boolean;
|
||||
isProcessing: boolean;
|
||||
partialTranscript: string;
|
||||
volume: number;
|
||||
|
||||
@@ -59,6 +59,7 @@ export function useDictation(options: UseDictationOptions): UseDictationResult {
|
||||
useEffect(() => {
|
||||
isRecordingRef.current = isRecording;
|
||||
}, [isRecording]);
|
||||
const isRecordingActive = useCallback(() => isRecordingRef.current, []);
|
||||
|
||||
const isProcessingRef = useRef(isProcessing);
|
||||
useEffect(() => {
|
||||
@@ -453,6 +454,7 @@ export function useDictation(options: UseDictationOptions): UseDictationResult {
|
||||
|
||||
return {
|
||||
isRecording,
|
||||
isRecordingActive,
|
||||
isProcessing,
|
||||
partialTranscript,
|
||||
volume: audio.volume,
|
||||
|
||||
Reference in New Issue
Block a user