mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
🎤 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:
parent
d18d62e7c1
commit
b91c1c2508
2 changed files with 0 additions and 7 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -385,7 +385,6 @@ const ChatForm = memo(function ChatForm({
|
|||
<AudioRecorder
|
||||
methods={methods}
|
||||
ask={submitMessage}
|
||||
textAreaRef={textAreaRef}
|
||||
disabled={disableInputs || isNotAppendable}
|
||||
isSubmitting={isSubmitting}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue