fix(app): resolve create agent dictation confirm handler timing issue

Fixed a state management bug where clicking the checkmark in create agent dictation mode would not trigger processing. The issue was that setIsDictationProcessing(true) was called after stopping the recorder, causing a race condition where the UI never showed the processing state.

Changes:
- Move setIsDictationProcessing(true) to execute immediately at the start of the confirm handler
- Add proper cleanup when audioData is null
- Ensure UI shows loading spinner when checkmark is clicked

This aligns the create agent dictation behavior with the working agent chat dictation implementation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2025-11-28 10:10:31 +00:00
co-authored by Claude
parent b97ae99b2b
commit 2c84447ec2
10 changed files with 694 additions and 188 deletions
@@ -983,16 +983,20 @@ function AgentFlowModal({
);
return;
}
// Set processing state BEFORE stopping to ensure UI updates properly
setIsDictationProcessing(true);
try {
const audioData = await dictationRecorder.stop();
setIsDictating(false);
setDictationVolume(0);
if (!audioData) {
setIsDictationProcessing(false);
return;
}
const requestId = generateMessageId();
dictationRequestIdRef.current = requestId;
setIsDictationProcessing(true);
await sendAgentAudio(
DICTATION_AGENT_ID,
audioData,