Skip to content

fix: guard against undefined return from sendFunction in push-to-talk#1

Open
HowieG wants to merge 1 commit into
mainfrom
fix/voice-send-function-undefined-crash
Open

fix: guard against undefined return from sendFunction in push-to-talk#1
HowieG wants to merge 1 commit into
mainfrom
fix/voice-send-function-undefined-crash

Conversation

@HowieG

@HowieG HowieG commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • sendFunction in use-push-to-talk.tsx wraps sendMessage which returns Promise<void>, so the result is always undefined
  • Accessing .id on undefined throws a TypeError, crashing the push-to-talk voice feature
  • Added a null check to skip setStartReadingFromMessageId when the return is undefined, which is safe since the existing code at line 169 already guards against startReadingFromMessageId being unset

Fixes CopilotKit#3042
Fixes CopilotKit#3011

Test plan

  • nx run @copilotkit/react-ui:build succeeds
  • Manual test: use push-to-talk voice feature — should no longer crash on message.id
  • Verify TTS reading still works when sendFunction returns a message object

🤖 Generated with Claude Code

sendFunction (wrapping sendMessage) returns Promise<void>, so accessing
.id on the result throws a TypeError. Add a null check to skip setting
startReadingFromMessageId when the return value is undefined.

Fixes CopilotKit#3042, fixes CopilotKit#3011

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant