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'm using webchat with a rasa server and a mern application.
Everything is working fine but on firefox if I press enter to send my message, instead of sending the message I get redirected to http://localhost:3000/?message=yes
After this, probably because of my react routes, the browser returns to the previous location, http://localhost:3000/, and the chat is in the state it was before pressing enter to send the message.
Clicking on the send button of the chat widget however works correctly.
Also, on chrome this behavior is not happening.
The text was updated successfully, but these errors were encountered:
It seems like that FF's default behavior when a form is submitted that the page gets refreshed.
By prohibiting this, this behavior does not happen anymore.
Following code can be used to implement such logic:
constfindFormTimeoutRef=React.useRef<any>();constinjectSubmit=()=>{constform=document.querySelector(".rw-sender");if(form){// Following code stops the form// from submitting before .click is calledform.addEventListener("submit",function(e){e.preventDefault();});}else{if(findFormTimeoutRef.current){clearTimeout(findFormTimeoutRef.current);}findFormTimeoutRef.current=setTimeout(injectSubmit,100);}};React.useEffect(()=>{injectSubmit();},[]);
I'm using webchat with a rasa server and a mern application.
Everything is working fine but on firefox if I press enter to send my message, instead of sending the message I get redirected to
http://localhost:3000/?message=yes
After this, probably because of my react routes, the browser returns to the previous location,
http://localhost:3000/
, and the chat is in the state it was before pressing enter to send the message.Clicking on the send button of the chat widget however works correctly.
Also, on chrome this behavior is not happening.
The text was updated successfully, but these errors were encountered: