chat-ui-kit-react icon indicating copy to clipboard operation
chat-ui-kit-react copied to clipboard

msgRef.current is null but got check undefined in the ContentEditable component causing app crashed

Open tunglamforwork opened this issue 6 months ago • 1 comments

I am facing an error that it'll crash the app entirely. When I traced the error, it shows into this part:

if (typeof msgRef.current === "undefined") {
  return true;
}

image

image

Based on the error, I think the above line should be checking for null not undefined right. Someone please help, thanks a lot!!

Originally posted by @tunglamforwork in https://github.com/chatscope/chat-ui-kit-react/discussions/173

tunglamforwork avatar Jun 20 '25 03:06 tunglamforwork

@tunglamforwork I think the source of the error lies elsewhere — inputRef might not be what you expect it to be. Could you share how you're defining or assigning inputRef? It would help to see the relevant part of your code.

Also, could you please explain where the following code is from?

if (typeof msgRef.current === "undefined") {
  return true;
}

supersnager avatar Jun 24 '25 07:06 supersnager