From fc6345e246eb412a1a4d7d5b665ada04a1a6aa2d Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 10 Sep 2024 09:18:54 -0700 Subject: [PATCH] Simplify setImagePath for upload from chat input area of web app --- .../web/app/components/chatInputArea/chatInputArea.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx index 9a763d15..7e845009 100644 --- a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx +++ b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx @@ -78,7 +78,7 @@ export default function ChatInputArea(props: ChatInputProps) { const [recording, setRecording] = useState(false); const [imageUploaded, setImageUploaded] = useState(false); - const [imagePath, setImagePath] = useState(null); + const [imagePath, setImagePath] = useState(""); const [imageData, setImageData] = useState(null); const [mediaRecorder, setMediaRecorder] = useState(null); @@ -123,7 +123,7 @@ export default function ChatInputArea(props: ChatInputProps) { function onSendMessage() { if (imageUploaded) { setImageUploaded(false); - setImagePath(null); + setImagePath(""); props.sendImage(imageData || ""); } if (!message.trim()) return; @@ -328,7 +328,7 @@ export default function ChatInputArea(props: ChatInputProps) { function removeImageUpload() { setImageUploaded(false); - setImagePath(null); + setImagePath(""); } return ( @@ -449,7 +449,7 @@ export default function ChatInputArea(props: ChatInputProps) { {imageUploaded && (
- img + img
{ if (e.key === "Enter" && !e.shiftKey) { setImageUploaded(false); - setImagePath(null); + setImagePath(""); e.preventDefault(); onSendMessage(); }