mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: add null check for inputValue in ChatTextArea
The inputValue prop could be undefined when the component renders, causing a crash when calling .trim() on it. Added defensive null checks using fallback to empty string.
This commit is contained in:
parent
44fd975b17
commit
3372288a98
1 changed files with 2 additions and 2 deletions
|
|
@ -245,7 +245,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
}, [selectedType, searchQuery])
|
||||
|
||||
const handleEnhancePrompt = useCallback(() => {
|
||||
const trimmedInput = inputValue.trim()
|
||||
const trimmedInput = (inputValue || "").trim()
|
||||
|
||||
if (trimmedInput) {
|
||||
setIsEnhancingPrompt(true)
|
||||
|
|
@ -259,7 +259,7 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
|
||||
// Memoized check for whether the input has content (text or images)
|
||||
const hasInputContent = useMemo(() => {
|
||||
return inputValue.trim().length > 0 || selectedImages.length > 0
|
||||
return (inputValue || "").trim().length > 0 || selectedImages.length > 0
|
||||
}, [inputValue, selectedImages])
|
||||
|
||||
// Compute the key combination text for the send button tooltip based on enterBehavior
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue