You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a function called handleSubmitForm tied to my form onSubmit. The function does some checks before calling the handleSubmit function of the useChat.
consthandleSubmitForm=(e: React.FormEvent<HTMLFormElement>)=>{e.preventDefault();// codeif(!condition){// more codereturn;}handleSubmit(e);};
The issue arises when the condition fails in handleSubmitForm and it returns without triggering handleSubmit. Now when the condition is met next time, handleSubmit fails to execute. I commented return in the conditional statement and it worked. I then wrapped handleSubmit in an else block like below and then it stopped working again.
consthandleSubmitForm=(e: React.FormEvent<HTMLFormElement>)=>{e.preventDefault();// codeif(!condition){// more codereturn;}else{handleSubmit(e);}};
The same thing happens with append as well. I am stuck because of it.
The text was updated successfully, but these errors were encountered:
Description
I have a function called
handleSubmitForm
tied to my formonSubmit
. The function does some checks before calling thehandleSubmit
function of theuseChat
.The issue arises when the condition fails in
handleSubmitForm
and it returns without triggeringhandleSubmit
. Now when the condition is met next time,handleSubmit
fails to execute. I commentedreturn
in the conditional statement and it worked. I then wrappedhandleSubmit
in an else block like below and then it stopped working again.The same thing happens with
append
as well. I am stuck because of it.The text was updated successfully, but these errors were encountered: