🚧 refactor: Attempt Default Preset Fix & Other Changes (#2342)

* fix(useTextarea): trigger SendButton re-render on undo and clearing text

* refactor(PresetItems): show pin icon for default preset

* fix(ChatRoute): do not use conversation.model for useEffect, do not set default Preset if real model list is not yet fetched
This commit is contained in:
Danny Avila 2024-04-06 16:09:16 -04:00 committed by GitHub
parent 476767355b
commit 334b603247
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 15 deletions

View file

@ -160,9 +160,11 @@ export default function useTextarea({
const isUndo = e.key === 'z' && (e.ctrlKey || e.metaKey);
if (isUndo && target.value.trim() === '') {
textAreaRef.current?.setRangeText('', 0, textAreaRef.current?.value?.length, 'end');
setValue('text', '', { shouldValidate: true });
forceResize(textAreaRef);
} else if (isUndo) {
trimUndoneRange(textAreaRef);
setValue('text', '', { shouldValidate: true });
forceResize(textAreaRef);
}