📋 fix: Ensure Textarea Resizes in Clipboard Edge Case (#2268)

* chore: ts-ignore fake conversation data used for testing

* chore(useTextarea): import helper functions to declutter hook

* fix(Textarea): reset textarea value explicitly by resetting `textAreaRef.current.value`
This commit is contained in:
Danny Avila 2024-04-01 13:40:21 -04:00 committed by GitHub
parent d07396d308
commit aff219c655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 63 additions and 55 deletions

View file

@ -3,9 +3,9 @@ import { useForm } from 'react-hook-form';
import { memo, useCallback, useRef, useMemo } from 'react';
import {
supportsFiles,
EModelEndpoint,
mergeFileConfig,
fileConfig as defaultFileConfig,
EModelEndpoint,
} from 'librechat-data-provider';
import { useChatContext, useAssistantsMapContext } from '~/Providers';
import { useRequiresKey, useTextarea } from '~/hooks';
@ -43,9 +43,9 @@ const ChatForm = ({ index = 0 }) => {
setFiles,
conversation,
isSubmitting,
handleStopGenerating,
filesLoading,
setFilesLoading,
handleStopGenerating,
} = useChatContext();
const assistantMap = useAssistantsMapContext();
@ -57,7 +57,9 @@ const ChatForm = ({ index = 0 }) => {
}
ask({ text: data.text });
methods.reset();
textAreaRef.current?.setRangeText('', 0, data.text.length, 'end');
if (textAreaRef.current) {
textAreaRef.current.value = '';
}
},
[ask, methods],
);