Skip to content

Commit c9ae76b

Browse files
Merge pull request #398 from microsoft/PSL-BUG-19259
fix: reset chat input character count on "New Topic" button click
2 parents e370f18 + 9b12568 commit c9ae76b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

App/frontend-app/src/components/chat/chatRoom.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
7373
});
7474
const [referencesForFeedbackForm, setReferencesForFeedbackForm] = useState<Reference[]>([]);
7575
const [textAreaValue, setTextAreaValue] = useState("");
76+
const [textareaKey, setTextareaKey] = useState(0);
7677
const inputRef = useRef<HTMLTextAreaElement>(null);
7778
const [allChunkTexts, setAllChunkTexts] = useState<string[]>([]);
7879

@@ -568,12 +569,15 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
568569
setSelectedDocument([]);
569570
setIsLoading(false);
570571
setChatSessionId(null);
572+
setTextAreaValue("");
573+
setTextareaKey(prev => prev + 1);
571574
}}
572575
>
573576
{t('components.chat.new-topic')}
574577
</Button>
575578

576579
<Textarea
580+
key={textareaKey}
577581
ref={inputRef}
578582
value={textAreaValue}
579583
className="!ml-4 max-h-48 w-full !max-w-none"

0 commit comments

Comments
 (0)