chatscope / chatscope/chat-ui-kit-react
msgRef.current is null but got check undefined in the ContentEditable component causing app crashed
- Dominant language
- JavaScript
- Stars
- 1.8k
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
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;
}
```


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_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in the ContentEditable component and inspect the msgRef.current check shown in the issue. Reproduce the reported crash or trace the null-ref path, then verify that the component no longer crashes when the ref is null and that existing behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100