🎤 fix: Keep Microphone Icon Visible On Initial Chat Render (#13788)

* 🎤 fix: Keep Microphone Icon Visible On Initial Chat Render

AudioRecorder returned null while the parent ChatForm's textAreaRef was still null on first paint, hiding the mic icon until an unrelated re-render. Render the button disabled instead so the icon is always present.

Closes #13786

* 🎤 refactor: Drop Unused textAreaRef Dependency From AudioRecorder

Per Codex review: deriving the button's disabled state from textAreaRef.current could leave the mic permanently disabled until an unrelated re-render, since assigning a ref does not trigger one. The handlers never read the ref, so remove the dependency entirely along with the now-unused prop.
This commit is contained in:
Danny Avila 2026-06-16 11:06:02 -04:00 committed by GitHub
parent d18d62e7c1
commit b91c1c2508
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 7 deletions

View file

@ -11,13 +11,11 @@ export default memo(function AudioRecorder({
disabled,
ask,
methods,
textAreaRef,
isSubmitting,
}: {
disabled: boolean;
ask: TAskFunction;
methods: ReturnType<typeof useChatFormContext>;
textAreaRef: React.RefObject<HTMLTextAreaElement>;
isSubmitting: boolean;
}) {
const { setValue, reset, getValues } = methods;
@ -82,10 +80,6 @@ export default memo(function AudioRecorder({
onTranscriptionComplete,
);
if (!textAreaRef.current) {
return null;
}
const handleStartRecording = async () => {
existingTextRef.current = getValues('text') || '';
startRecording();

View file

@ -385,7 +385,6 @@ const ChatForm = memo(function ChatForm({
<AudioRecorder
methods={methods}
ask={submitMessage}
textAreaRef={textAreaRef}
disabled={disableInputs || isNotAppendable}
isSubmitting={isSubmitting}
/>